Home > Java > javaTutorial > Why Does Upgrading to Hibernate 4.3.0.Final Cause a NoSuchMethodError in javax.persistence.Table.indexes()?

Why Does Upgrading to Hibernate 4.3.0.Final Cause a NoSuchMethodError in javax.persistence.Table.indexes()?

Linda Hamilton
Release: 2024-11-28 17:20:11
Original
774 people have browsed it

Why Does Upgrading to Hibernate 4.3.0.Final Cause a NoSuchMethodError in javax.persistence.Table.indexes()?

NoSuchMethodError in javax.persistence.Table.indexes()

In Play Framework applications using Hibernate, upgrading to Hibernate 4.3.0.Final can cause a NoSuchMethodError exception in javax.persistence.Table.indexes(). Here's why this occurs and how to resolve it:

Cause:

The issue arises due to a conflict between different versions of the JPA specifications loaded into the classpath. Play relies on a specific version of the JPA specification, while Hibernate 4.3.0.Final requires a newer version. When both versions are present, a conflict occurs, leading to the error.

Resolution:

To resolve this error, you need to exclude the older JPA specification from Play's classpath while adding the newer version required by Hibernate 4.3.0.Final.

For Play 2.2.x, modify your build.sbt file as follows:

libraryDependencies ++= Seq(
  javaJdbc,
  javaJpa.exclude("org.hibernate.javax.persistence", "hibernate-jpa-2.0-api"),
  "org.hibernate" % "hibernate-entitymanager" % "4.3.0.Final"
)
Copy after login

For earlier versions of Play, refer to the specific documentation for your version.

By excluding the older JPA specification, you ensure that only the newer version required by Hibernate 4.3.0.Final is used, resolving the conflict and the NoSuchMethodError exception.

The above is the detailed content of Why Does Upgrading to Hibernate 4.3.0.Final Cause a NoSuchMethodError in javax.persistence.Table.indexes()?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template