Same Query runs in older version of Hibernate 3.1.2, but after i upgraded my Hibernate version to 3.2.5 ga, the Same query doesn't run instantly produce the "with-clause referenced two different from-clause elements" Exception,
what can i do, Is there any configuration changes or else other.
Following is relevant query
Hibernate version: 3.2.5.ga
Mapping documents: <class name="org.info.hibernate.StudentDayAttendance" table="student_day_attendance" catalog="university_coimbatore_hiber">
<comment></comment>
<id name="studentAttendanceId" type="int">
<column name="student_attendance_id" />
<generator class="assigned" />
</id>
<many-to-one name="studentsMaster" class="org.info.hibernate.StudentsMaster" fetch="select" >
<column name="student_id" not-null="true">
<comment></comment>
</column>
</many-to-one>
Code between sessionFactory.openSession() and session.close():
transaction.beginTransaction();
Session sess=getSession();
String studAttendance="SELECT sm.studName,concat('',ifnull(sm.regNumber,sm.enrollNumber)),sda.studentAttendanceId,ace.academicEventId,ac.calendarDate,concat('',ifnull(ace.isLeave,sda.obtainedPeriod)),concat('',ifnull(ace.isLeave,sda.totalPeriod)) from org.info.hibernate.AcademicCalendar ac inner join ac.courseTermAcademic cta inner join cta.courseTermDetailses ctd inner join ctd.studentsMastersForCurrentSemester sm LEFT JOIN ac.academicCalendarEvents ace LEFT JOIN ac.studentDayAttendances sda with sda.studentsMaster.id=sm.id where ac.calendarDate between '2007-06-25' and '2007-06-30' and sm.collegeMain.collegeId=8 and ctd.courseTermId=1 and cta.academicId=1 order by sm.enrollNumber"
itr=sess.createQuery(studAttendance).list();
transaction.commit();
Full stack trace of any exception that occurs:with-clause referenced two different from-clause elements
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:235)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
at $Proxy2.createQuery(Unknown Source)
Name and version of the database you are using: MySQL 5.0.20
Thanks in advance.
Last edited by kumar_hiber on Thu Jul 24, 2008 3:17 am, edited 1 time in total.
|