users@glassfish.java.net

EJBQL Exception

From: <glassfish_at_javadesktop.org>
Date: Mon, 30 Apr 2007 18:04:05 PDT

Hi,

I'm a Java Persistence newbie having a massive problem spotting the error that is triggering an Unknown state or association field exception.

I have created a Persistence Entity with the following excerpted code, plus the necessary get/set methods:

@Entity
public class Seller implements java.io.Serializable {

    private String sellerID;
    private String selcatID;
    private String name;
      
    public Seller() { }
    public Seller(String sellerID, String selcatID, String name)
    {
        this.sellerID = sellerID;
        this.selcatID = selcatID;
        this.name = name;
     }

In another Java file, I have a method that references the selcatID attribute of the Seller entity:

    @SuppressWarnings("unchecked")
    public List<Seller> getSellersBySelCatVLH(String selCatID, int start,
            int chunkSize){
        EntityManager em = emf.createEntityManager();
        Query query = em.createQuery("SELECT s FROM Seller s, SelCat t WHERE " +
                "s.selcatID = t.selcatID AND t.selcatID = :selcatID AND s.disabled = 0" +
                " ORDER BY s.name");
        List<Seller> sellers = query.setParameter("selcatID",selCatID).setFirstResult(start).setMaxResults(chunkSize).getResultList();
        em.close();
        return sellers;
    }

Note that the case usage in the selcatID call in the method matches the case used in the Entity definition code. Yet I continue to get this exception:

Exception [TOPLINK-8030] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.EJBQLException
Exception Description: Unknown state or association field [selcatID] of class [...Seller].

I have been through the server log stack trace and confirmed that this is the only method cited in the trace that references this attribute.

Can anyone spot what I am missing?

Thanks in advance for any guidance.
[Message sent by forum member 'drscoville' (drscoville)]

http://forums.java.net/jive/thread.jspa?messageID=214988