Pular para o conteúdo
  • Este tópico contém 1 resposta, 1 voz e foi atualizado pela última vez 8 anos, 3 meses atrás por Avatar de Paulo FerreiraPaulo Ferreira.
Visualizando 2 posts - 1 até 2 (de 2 do total)
  • Autor
    Posts
  • #107975
    Avatar de Paulo FerreiraPaulo Ferreira
    Participante

      Oi Pessoal,

      Estou fazendo um projeto Java Web usando Oracle, Hibernate, JUnit, Maven e Primefaces.
      Criei um projeto maven só para guardar as classes de modelo, serviço, persistencia, testes, etc. e estou importando esse projeto maven em vários projetos Java Web, o meu objetivo é ter uma espécie de biblioteca central.
      OBS: Trabalho em um hospital.
      Testando a pesquisa de leitos por meio do projeto maven (a biblioteca central) está funcionando mas fazendo a pesquisa pelo projeto Java Web fica dando a seguinte exceção:

      =================================================================================
      java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
      at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2884)
      at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1798)
      at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:963)
      at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796)
      at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3845)
      at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3799)
      at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1412)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
      at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
      at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
      at br.com.bhst.persistence.util.DaoFactory.entityManagerFactoryInstance(DaoFactory.java:36)
      at br.com.bhst.persistence.util.GenericDao.(GenericDao.java:19)
      at br.com.bhst.persistence.dao.dbamv.LeitoDao.(LeitoDao.java:11)
      at br.com.bhst.service.LeitoService.leitosParaSenir(LeitoService.java:55)
      at br.com.swmleitos.manager.SenirBean.update(SenirBean.java:59)
      at br.com.swmleitos.manager.SenirBean.(SenirBean.java:24)
      at br.com.swmleitos.manager.SenirBeanTest.test(SenirBeanTest.java:14)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      =================================================================================

      Vendo em alguns fóruns vi que o problema está relacionado a versão do JPA e por isso adicionei a dependência abaixo no projeto maven (a biblioteca central):

      org.eclipse.persistence
      javax.persistence
      2.1.1
      Mas não está funcionado e estou ficando meio perdido.
      Vocês tem alguma ideia do que eu posso fazer?

      #107976
      Avatar de Paulo FerreiraPaulo Ferreira
      Participante

        Voltei para a versão 4.2.21.Final do Hibernate que dá suporte para o JPA 2.0

      Visualizando 2 posts - 1 até 2 (de 2 do total)
      • Você deve fazer login para responder a este tópico.
      plugins premium WordPress