Error: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey with Spring controller

后端 未结 4 491
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 00:21

I have a simple two table application written in Spring MVC and which uses Hibernate. Everything works perfectly well but if I try to unit test one of the controllers, I get

4条回答
  •  孤城傲影
    2020-12-07 01:01

    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 then try upgrading to 4.3.x.

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

提交回复
热议问题