我有一个Play Framework应用程序,并且正在使用Hibernate 4.2.5.Final(可通过Maven依赖管理器检索)。我决定升级到Hibernate 4.3.0.Final,成功重新编译我的应用程序,然后运行它。
我在下面有一个例外,但无法弄清楚原因。我降级到4.2.5,并且没有发生此问题。然后,我尝试在4.2.5之后的每个最终版本中升级Hibernate。也就是说,我从4.2.5.Final到4.2.6.Final,再到4.2.7.Final,再到4.2.8.Final,再到4.3.Final。在我升级到4.3.0.Final之前不会发生此问题。
Java版本信息
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
和例外:
play.api.UnexpectedException: Unexpected exception[NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:152) ~[play_2.10.jar:2.2.1]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:112) ~[play_2.10.jar:2.2.1]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:112) ~[play_2.10.jar:2.2.1]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:110) ~[play_2.10.jar:2.2.1]
at scala.util.Success.flatMap(Try.scala:200) ~[scala-library.jar:na]
Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:936) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:781) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3762) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3716) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]