Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] RE: Exception in order by clause after migrating to eclipselink 1.2release

While debugging further, I found that the field isManager was not being considered a valid field in the ClassDescription created for entity Emp. I suspected the name of the field causing this issue and when I changed the name to ‘mgr’ from ‘isManager’ it started working fine. I still am confused why the name of the field caused this issue.


Request some light on this.





From: Shashikant Kale
Sent: Saturday, March 27, 2010 2:32 PM
To: eclipselink-users@xxxxxxxxxxx
Subject: Exception in order by clause after migrating to eclipselink 1.2release




I have migrated to eclipselink 1.2 version (to be precise 1.2.0.v20091016-r5565).


I have a simple entity which has association with itself. The structure is defined below.



@NamedQuery(name = "Emp.findAll", query = "SELECT DISTINCT emp from Emp emp order by emp.isManager ASC")

public class Emp implements Serializable {


            …….//Some fields


            @Column(name = "IS_MANAGER")

            private String isManager;



            @JoinColumn(name = "MANAGER_NO")

            private Emp manager;


……//Some more fields


            public Emp getManager() {

                        return this.manager;


            public void setManager(Emp mgr) {

                        this.manager = mgr;


            public String getIsManager() {

                        return isManager;


            public void setIsManager(String isManager) {

                        this.isManager = isManager;




When running with eclipselink 1.1 when the named query Emp.findAll iit works all fine, however with 1.2 version I started getting exception


Exception [EclipseLink-8030] (Eclipse Persistence Services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.JPQLException

Exception Description: Error compiling the query [Emp.findAll: SELECT DISTINCT emp from Emp emp order by emp.isManager ASC], line 1, column 46: unknown state or association field [isManager] of class [com.arisglobal.aglitepq.entity.Emp].

      at org.eclipse.persistence.exceptions.JPQLException.unknownAttribute(

      at org.eclipse.persistence.internal.jpa.parsing.DotNode.validate(

      at org.eclipse.persistence.internal.jpa.parsing.OrderByItemNode.validate(

      at org.eclipse.persistence.internal.jpa.parsing.OrderByNode.validate(

      at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(

      at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(

      at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(

      at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(

      at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(

      at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(

      at org.eclipse.persistence.internal.jpa.JPAQuery.processJPQLQuery(

      at org.eclipse.persistence.internal.jpa.JPAQuery.prepare(

      at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(

      at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(

      at org.eclipse.persistence.internal.sessions.AbstractSession.processJPAQueries(

      at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(

      at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(

      at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(

      at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(

      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(

      at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(

      at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(

      at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(



I suspected the self reference to the entity (“manager” field) and removed it to find everything working fine. However this is a test example and we have many entities where self reference is required. Not sure how to change the query to make it work.


Any help regarding this is appreciated.


Back to the top