R Pidugu

Resolution for Error: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey

Error: "javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey"

I was  trying to implement Hibernate Search functionality on my current project. I faced the above issue and resolved it with some research.

Root cause and Solution: 
 JoinColumn.foreignKey() was introduced with JPA 2.1, which was not implemented by Hibernate 4 until version 4.3. If you're using an older version of Hibernate 4, you will face this issue. Try to upgrade it to hibernate-jpa-2.1-api  and also Hibernate to 4.3.x.

If you're already using Hibernate 4.3 then make sure you're also using hibernate-jpa-2.1-api to make sure the API and implementation match up.

Subscribe to this Blog via Email :