我试图在Spring 3.0 ORM中使用JPA 2.0. JPA供应商是Hibernate 3.5.0-Beta-3.
它适用于JPQL,但是当我尝试使用CriteriaQuery时,会发生异常:
@H_404_7@java.lang.ClassCastException: $Proxy50
cannot be cast to
javax.persistence.TypedQuery at
$Proxy38.createQuery(Unknown Source)
at
com.absorbx.retailx.dao.impl.ShopDaoImpl.findByCrieria(ShopDaoImpl.java:30)
at
com.absorbx.retailx.dao.SimpleDaoTest.testFindByCriteria(SimpleDaoTest.java:39)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
@Repository
public class ShopDaoImpl implements
ShopDao {
@PersistenceContext
transient EntityManager entityManager;
@Override
public Shop findByCrieria() {
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery
我该如何解决这个问题?