开发者

EclipseLink (JPA 2) Missing Descriptor Exception

开发者 https://www.devze.com 2023-02-10 07:36 出处:网络
I am having an issue 开发者_Go百科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:

I am having an issue 开发者_Go百科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


Maybe try:

SELECT l FROM Lookup instead of SELECT l FROM lookup?

0

精彩评论

暂无评论...
验证码 换一张
取 消