EclipseLink (JPA 2) Missing Descriptor Exception

7.6k Views Asked by At

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

1

There are 1 best solutions below

0
On BEST ANSWER

Maybe try:

SELECT l FROM Lookup instead of SELECT l FROM lookup?