AbstractMethodError when creating typed query with Hibernate 3.6.3 and JPA 2.0

泪湿孤枕 提交于 2019-12-06 02:41:34

You have quite a mix of Hibernate and JPA versions. In subject line you mention Hibernate version 3.6.3 and JPA version 2.0. According body text EntityManagerImpl is version 3.3.2.GA. This mesh up with versions causes your problem.

TypedQuery was introduced in JPA 2.0 and Hibernate implements this specification since 3.5.X. Now you have EntityManager interface with

<T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery)

but actual implementation does not implements such a method. That's why you get AbstractMethodError. Your second query works fine, because it uses JPA 1.0 constructs with one of the it's implementations (3.3.2.GA.) Just use implementation from Hibernate version 3.6.3 (or better even never).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!