“java.lang.NoSuchFieldError: NONE” in hibernate with Spring 3, maven, JPA, c3p0

后端 未结 2 1998
太阳男子
太阳男子 2020-12-21 23:19

Problem:

Hibernate is not executing queries correctly. It errors with a problem that appears to be related to slf4j but using any recommended fixes don\'t seem to wo

相关标签:
2条回答
  • 2020-12-21 23:59

    It's complaining about this code line in org.hibernate.ejb.QueryImpl:

    private javax.persistence.LockModeType jpaLockMode
       = javax.persistence.LockModeType.NONE;
    

    Since javax.persistence.LockModeType.NONE is new in JPA2, I suspect you also have JPA1 on your classpath somewhere. Find and remove it.

    0 讨论(0)
  • 2020-12-22 00:18

    You included old version of hibernate-commons-annotations, which transitively included JPA 1.0, which conflicts with JPA 2.0 required by Hibernate 3.5.

    Moreover, since Hibernate 3.5 you don't need to include multiple Hibernate artifacts anymore. You only need to declare hibernate-entitymanager in pom.xml, it should be enough for your setup.

    See also:

    • Hibernate Compatibility Matrix
    0 讨论(0)
提交回复
热议问题