[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
Re: [eclipselink-users] RE: Exception in order by clause	aftermigrating to eclipselink 1.2release
 | 
Hi Shashikant,
  Please enter a bug and including a way of reproducing the problem.
-Tom
Shashikant Kale wrote:
Hi EclipseLink developers,
 
Any thoughts on this?
 
Regards,
Shashi
 
------------------------------------------------------------------------
*From:* eclipselink-users-bounces@xxxxxxxxxxx 
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] *On Behalf Of *Shashikant 
Kale
*Sent:* Saturday, March 27, 2010 6:57 PM
*To:* eclipselink-users@xxxxxxxxxxx
*Subject:* [eclipselink-users] RE: Exception in order by clause 
aftermigrating 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.
 
Thanks,
Shashi
 
------------------------------------------------------------------------
*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
 
Hi,
 
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.
 
@Entity
@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;
           
            @ManyToOne(cascade=CascadeType.REFRESH)
            @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(_JPQLException.java:457_)
      at 
org.eclipse.persistence.internal.jpa.parsing.DotNode.validate(_DotNode.java:78_)
      at 
org.eclipse.persistence.internal.jpa.parsing.OrderByItemNode.validate(_OrderByItemNode.java:52_)
      at 
org.eclipse.persistence.internal.jpa.parsing.OrderByNode.validate(_OrderByNode.java:72_)
      at 
org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(_ParseTree.java:214_)
      at 
org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(_ParseTree.java:187_)
      at 
org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(_ParseTree.java:177_)
      at 
org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(_JPQLParseTree.java:110_)
      at 
org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(_JPQLParseTree.java:84_)
      at 
org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(_EJBQueryImpl.java:170_)
      at 
org.eclipse.persistence.internal.jpa.JPAQuery.processJPQLQuery(_JPAQuery.java:106_)
      at 
org.eclipse.persistence.internal.jpa.JPAQuery.prepare(_JPAQuery.java:90_)
      at 
org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(_DatabaseQuery.java:464_)
      at 
org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(_DatabaseQuery.java:430_)
      at 
org.eclipse.persistence.internal.sessions.AbstractSession.processJPAQueries(_AbstractSession.java:1747_)
      at 
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(_DatabaseSessionImpl.java:409_)
      at 
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(_DatabaseSessionImpl.java:671_)
      at 
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(_DatabaseSessionImpl.java:633_)
      at 
org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(_EntityManagerFactoryProvider.java:233_)
      at 
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(_EntityManagerSetupImpl.java:269_)
      at 
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(_EntityManagerFactoryImpl.java:146_)
      at 
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(_EntityManagerFactoryImpl.java:198_)
      at 
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(_EntityManagerFactoryImpl.java:186_)
 
 
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.
Thanks,
Shashi
------------------------------------------------------------------------
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users