Can some one help with this to figure out whether it is HQL issue or my mapping issue please.
Thanks
Raj.
Hibernate Version :2
Spring Version:1.1.5
EXCEPTION:
org.springframework.orm.hibernate.HibernateQueryException: outer or full join must be followed by path expression [
FROM com.mycompany.calendarmodel.data.CalEvent calEvent left join CalLneDtls calLneDtls ON calEvent.event_id = calEvent.calLneDtls.event_id
WHERE (calEvent.start_date <= :start AND calEvent.end_date >= :start OR calEvent.start_date BETWEEN :start AND :end)
AND calLneDtls.sale_type IS NOT NULL
AND calLneDtls.sale_type IN (:sTypes0_, :sTypes1_, :sTypes2_)
AND calLneDtls.consignor_id IN (:cIds0_, :cIds1_, :cIds2_)
AND calEvent.auction_id IN (:aIds0_, :aIds1_, :aIds2_)
]; nested exception is net.sf.hibernate.QueryException: outer or full join must be followed by path expression [
FROM com.mycompany.calendarmodel.data.CalEvent calEvent left join CalLneDtls calLneDtls ON calEvent.event_id = calEvent.calLneDtls.event_id
WHERE (calEvent.start_date <= :start AND calEvent.end_date >= :start OR calEvent.start_date BETWEEN :start AND :end)
AND calLneDtls.sale_type IS NOT NULL
AND calLneDtls.sale_type IN (:sTypes0_, :sTypes1_, :sTypes2_)
AND calLneDtls.consignor_id IN (:cIds0_, :cIds1_, :cIds2_)
AND calEvent.auction_id IN (:aIds0_, :aIds1_, :aIds2_)
]
net.sf.hibernate.QueryException: outer or full join must be followed by path expression [
FROM com.mycompany.calendarmodel.data.CalEvent calEvent left join CalLneDtls calLneDtls ON calEvent.event_id = calEvent.calLneDtls.event_id
WHERE (calEvent.start_date <= :start AND calEvent.end_date >= :start OR calEvent.start_date BETWEEN :start AND :end)
AND calLneDtls.sale_type IS NOT NULL
AND calLneDtls.sale_type IN (:sTypes0_, :sTypes1_, :sTypes2_)
AND calLneDtls.consignor_id IN (:cIds0_, :cIds1_, :cIds2_)
AND calEvent.auction_id IN (:aIds0_, :aIds1_, :aIds2_)
]
at net.sf.hibernate.hql.FromParser.token(FromParser.java:166)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:293)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1530)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1501)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.mycompany.calendarmodel.dao.CalendarDAOImpl$1.doInHibernate(CalendarDAOImpl.java:90)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:289)
at com.mycompany.calendarmodel.dao.CalendarDAOImpl.executeCallBack(CalendarDAOImpl.java:67)
at com.mycompany.calendarmodel.dao.CalendarDAOImpl.getMastercalendar(CalendarDAOImpl.java:28)
at java.lang.reflect.Method.invoke(Native Method)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:284)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:163)
at $Proxy0.getMastercalendar(Unknown Source)
at com.mycompany.calendarmodel.access.CalendarManagerImpl.getMastercalendar(CalendarManagerImpl.java:34)
at com.mycompany.calendarmodel.test.CalendarTest.testCalendarMaster(CalendarTest.java:64)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
CalendarDAO.java
****************
public List getEvents()
{
Map params = new HashMap();
params.put(Constants.START_DATE, Util.format(start));
params.put(Constants.END_DATE, Util.format(end));
params.put(Constants.SALE_TYPES, saleTypes);
params.put(Constants.CONSIGNOR_IDS, consignorIds);
params.put(Constants.AUCTION_IDS, auctionIds);
executeCallBack(params, "calendarMasterQry");
}
private List executeCallBack(final Map params, final String qry) throws CalendarException
{
List returnedList = (List) getHibernateTemplate().execute(new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException
{
Query query = session.getNamedQuery(qry);
if (params != null && params.size() > 0)
{
Set keys = (Set) params.keySet();
Iterator keysIterator = (Iterator) keys.iterator();
while (keysIterator.hasNext())
{
String key = (String) keysIterator.next();
Object object = params.get(key);
if (object instanceof List)
{
query.setParameterList(key, (List) params.get(key));
}
else
{
query.setParameter(key, params.get(key));
}
}
}
return query.list();
}
});
return returnedList;
}
CalEvent.hbm.xml
****************
<hibernate-mapping>
<class name="com.mycompany.calendarmodel.data.CalEvent" table="CalEvent">
<id name="event_ID" type="string">
<column name="event_ID" sql-type="Decimal(9, 0)" not-null="true" />
<generator class="uuid.hex" />
</id>
<set name="calLneDtls" lazy="true">
<key column="event_ID" />
<one-to-many class="com.mycompany.calendarmodel.data.CalLneDtls" />
</set>
</class>
<query name="calendarMasterQry">
<![CDATA[
FROM CalEvent event left join CalLneDtls calLneDtls ON event.event_id = event.lane.event_id
WHERE (event.start_date <= :start AND event.end_date >= :start OR event.start_date BETWEEN :start AND :end)
AND lane.sale_type IS NOT NULL
AND lane.sale_type IN (:sTypes)
AND lane.consignor_id IN (:cIds)
AND event.auction_id IN (:aIds)
]]>
</query>
</hibernate-mapping>
CalLneDtls.hbm.xml
******************
<hibernate-mapping>
<class name="com.mycompany.calendarmodel.data.CalLneDtls" table="CalLneDtls">
<id name="event_ID" type="string">
<column name="event_ID" sql-type="Decimal(9, 0)" not-null="true" />
<generator class="uuid.hex" />
</id>
<many-to-one name="calEvent" class="com.mycompany.calendarmodel.data.CalEvent" outer-join="true" cascade="none"/>
</class>
</hibernate-mapping>
CalEvent.java
*************
public class CalEvent
{
private String event_ID;
private Set calLneDtls;
-------
-------
public String getevent_ID()
{
return event_ID;
}
public void setevent_ID(String event_ID)
{
this.event_ID = event_ID;
}
public Set getcalLneDtls()
{
return calLneDtls;
}
public void setcalLneDtls(Set set)
{
calLneDtls = set;
}
}
CalLneDtls.java
***************
public class CalLneDtls
{
private String event_ID;
private CalEvent calEvent;
------
------
public String getevent_ID()
{
return event_ID;
}
public void setevent_ID(String event_id)
{
this.event_ID = event_id;
}
public CalEvent getcalEvent()
{
return calEvent;
}
public void setcalEvent(CalEvent event)
{
calEvent = event;
}
}
|