使用JPA 2.0,Java EE 5,Weblogic 10.3(11g),JDK 6,EclipseLink。JPA QueryException - 必須提供參考類
當我嘗試運行此:
CriteriaQuery _criteriaquery = EM.getCriteriaBuilder().createQuery(Clazz);
Query query = EM.createQuery(_criteriaquery);
return query.getResultList();
我剛剛得到這個:
Caused by: Exception [EclipseLink-6029] (Eclipse Persistence Services - 2.1.2.v20101206-r8635): org.eclipse.persistence.exceptions.QueryException
Exception Description: A reference class must be provided.
Query: ReportQuery()
at org.eclipse.persistence.exceptions.QueryException.referenceClassMissing(QueryException.java:1004)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkDescriptor(ObjectLevelReadQuery.java:744)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:661)
可能是什麼這個錯誤的原因是什麼?
謝謝,這解決了我的問題。我認爲把一個Class類型的變量就足夠了。 – GabrielBB