我在Netbeans 6.9.1中针对Oracle 11g使用EclipseLink(JPA 2)时出现问题。尝试运行本机查询时,我不断收到以下错误:
Exception Description: Missing descriptor for [class Novartis.OTM.Data.Db.Entities.Lookup].
Query: ReadAllQuery(referenceClass=Lookup sql="SELECT l FROM lookup l WHERE l.lookup_type = :LookupType AND domain = :Domain")
他是代码:
public List<SelectItem> getLookupForUI(enumLookupType lookupType, String domain) throws Exception {
if (domain == null || domain.trim().equals(""))
throw new Exception("Parameter domain cannot be null or empty.");
else if (!this.isInitialized())
throw new Exception("Entity Manager not set.");
Query query = this._EM.createNativeQuery(_QueryGetLookupForUI, Lookup.class);
query.setParameter("LookupType", lookupType.toString());
query.setParameter("Domain", domain.trim());
List<SelectItem> selectItems = null;
List<Lookup> lookupList = (List<Lookup>) query.getResultList();
if (lookupList == null || lookupList.size() < 1)
return null;
else {
selectItems = new ArrayList<SelectItem>(lookupList.size());
for (Lookup lookUp : lookupList) {
selectItems.add(new SelectItem(lookUp.getLookupValue(), lookUp.getLookupName()));
}
}
return selectItems;
}
尽管检查我有一个有效的实体类,但我不知道为什么会失败。提前感谢您的帮助。
克里斯
答案 0 :(得分:1)
也许试试:
SELECT l FROM Lookup
代替SELECT l FROM lookup
?