EclipseLink (JPA 2) 缺少描述符异常

发布于 2024-10-16 18:47:40 字数 1420 浏览 10 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一腔孤↑勇 2024-10-23 18:47:41

也许尝试:

SELECT l FROM Lookup而不是SELECT l FROM Lookup

Maybe try:

SELECT l FROM Lookup instead of SELECT l FROM lookup?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文