Duvida sobre TopLINK(JPA)

1 resposta
K

Olá, estou começando a trabalhar agora com a API JPA, e gostaria de alguma ajuda nesse assunto, criei as entidades e o XML pelo NetBeans.

Bom, estou rodando o seguinte codigo para gerar a comunicação com o XML…

EntityManagerFactory emf = Persistence.createEntityManagerFactory ("HelpDesk2007PU"); EntityManager em = emf.createEntityManager ();

e esta me devolvendo o seguinte erro.

<blockquote>[TopLink Config]: 2007.02.27 09:28:14.779ServerSession(4461550)The alias name for the entity class [class Entidades.Conhecimentodescricao] is being defaulted to: Conhecimentodescricao.

[TopLink Config]: 2007.02.27 09:28:14.842ServerSession(4461550)The alias name for the entity class [class Entidades.Situacaosolicitacaoaberta] is being defaulted to: Situacaosolicitacaoaberta.

[TopLink Config]: 2007.02.27 09:28:14.842ServerSession(4461550)The alias name for the entity class [class Entidades.Solicitacaofeedback] is being defaulted to: Solicitacaofeedback.

[TopLink Config]: 2007.02.27 09:28:14.842ServerSession(4461550)The alias name for the entity class [class Entidades.Setoroperacional] is being defaulted to: Setoroperacional.

[TopLink Config]: 2007.02.27 09:28:14.857ServerSession(4461550)The alias name for the entity class [class Entidades.Acordoservico] is being defaulted to: Acordoservico.

[TopLink Config]: 2007.02.27 09:28:14.857ServerSession(4461550)The alias name for the entity class [class Entidades.Setoroperacionalusuariosmasters] is being defaulted to: Setoroperacionalusuariosmasters.

[TopLink Config]: 2007.02.27 09:28:14.857ServerSession(4461550)The alias name for the entity class [class Entidades.Usuario] is being defaulted to: Usuario.

[TopLink Config]: 2007.02.27 09:28:14.857ServerSession(4461550)The alias name for the entity class [class Entidades.Situacaosolicitacao] is being defaulted to: Situacaosolicitacao.

[TopLink Config]: 2007.02.27 09:28:14.857ServerSession(4461550)The alias name for the entity class [class Entidades.Empresa] is being defaulted to: Empresa.

[TopLink Config]: 2007.02.27 09:28:14.873ServerSession(4461550)The alias name for the entity class [class Entidades.Conhecimentotipo] is being defaulted to: Conhecimentotipo.

[TopLink Config]: 2007.02.27 09:28:14.873ServerSession(4461550)The alias name for the entity class [class Entidades.Modulos] is being defaulted to: Modulos.

[TopLink Config]: 2007.02.27 09:28:14.873ServerSession(4461550)The alias name for the entity class [class Entidades.Gruposdeusuarios] is being defaulted to: Gruposdeusuarios.

[TopLink Config]: 2007.02.27 09:28:14.873ServerSession(4461550)The alias name for the entity class [class Entidades.Tipousuario] is being defaulted to: Tipousuario.

[TopLink Config]: 2007.02.27 09:28:14.873ServerSession(4461550)The alias name for the entity class [class Entidades.Prioridadetiposituacao] is being defaulted to: Prioridadetiposituacao.

[TopLink Config]: 2007.02.27 09:28:14.873ServerSession(4461550)The alias name for the entity class [class Entidades.Solicitacoes] is being defaulted to: Solicitacoes.

[TopLink Config]: 2007.02.27 09:28:14.889ServerSession(4461550)The alias name for the entity class [class Entidades.Historicodesituacoesabertas] is being defaulted to: Historicodesituacoesabertas.

[TopLink Config]: 2007.02.27 09:28:14.889ServerSession(4461550)The alias name for the entity class [class Entidades.Setor] is being defaulted to: Setor.

[TopLink Config]: 2007.02.27 09:28:14.889ServerSession(4461550)The alias name for the entity class [class Entidades.Solicitacaosolucao] is being defaulted to: Solicitacaosolucao.

[TopLink Config]: 2007.02.27 09:28:14.889ServerSession(4461550)The alias name for the entity class [class Entidades.Prioridadetipo] is being defaulted to: Prioridadetipo.

[TopLink Config]: 2007.02.27 09:28:14.889ServerSession(4461550)The alias name for the entity class [class Entidades.Conhecimentoanexos] is being defaulted to: Conhecimentoanexos.

Exception in thread main java.lang.NullPointerException

at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:120)

at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)

at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)

at helpdesk2007.Main.main(Main.java:38)

Java Result: 1

</blockquote>

Como faço para realizar a conexão correta com o XML?

1 Resposta

K

Consegui fazer a conexão funcionar com esse codigo…

Empresa Empres = new Empresa &#40;1&#41;; EntityManagerFactory emf = Persistence.createEntityManagerFactory &#40;&quot;HelpDesk&quot;&#41;; EntityManager em = emf.createEntityManager &#40;&#41;; em.getTransaction &#40;&#41;.begin &#40;&#41;; em.persist &#40;Empres&#41;; System.out.println &#40;Empres.getEmpresaDescricao &#40;&#41;&#41;;

Mas por que o System.out.println esta me retornando Null??? Falta alguma coisa para corrigir essa persistencia?

Criado 27 de fevereiro de 2007
Ultima resposta 27 de fev. de 2007
Respostas 1
Participantes 1