EclipseLink (JPA 2) 缺少描述符异常
我在 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;
}
尽管检查了我是否有有效的实体类,但我不知道为什么会失败。预先感谢您的帮助。
克里斯
I am having an issue using EclipseLink (JPA 2) in Netbeans 6.9.1 against Oracle 11g. I keep getting the following error when attempting to run a Native Query:
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")
He's the code:
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;
}
Despite checking that I have a valid entity class, I don't know why this is failing. Thank you in advance for your assistance.
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许尝试:
SELECT l FROM Lookup
而不是SELECT l FROM Lookup
?Maybe try:
SELECT l FROM Lookup
instead ofSELECT l FROM lookup
?