Hi,
Would like to check if it is possible to add multiple join conditions using hibernate
InvProSummary.hbm.xml
Stop.hbm.xml
I didn't put many-to-one or one-to-many property link into hibernate hbm files....
I.e. i need to get the following join condition in SQL
"from InvProSummary as inv LEFT JOIN Stop as st " +
"ON inv.custId = st.custId " +
"where inv.custNo=?"
When i run this from SQL editors, it works fine. If i run from hibernate i am getting following error message
2007-12-29 08:40:57,384 [Thread-24] ERROR org.hibernate.hql.PARSER - line 1:87: unexpected token: ON
org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: ON near line 1, column 87 [from com.fil.web.dao.hibernate.InvProSummary as inv LEFT JOIN Stop as st ON inv.custId = st.custId where inv.custNo=?]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ON near line 1, column 87 [from com.fil.web.dao.hibernate.InvProSummary as inv LEFT JOIN Stop as st ON inv.custId = st.custId where inv.custNo=?]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:640)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:378)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:847)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:843)
at com.fil.web.dao.inv.InvProSummaryDAOImpl.getCustDetailsByCDB(InvProSummaryDAOImpl.java:91)
at com.fil.web.ui.investor.InvesterQueryTab$11.run(InvProSummaryQueryTab.java:270)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ON near line 1, column 87 [from com.fil.web.dao.hibernate.InvProSummary as inv LEFT JOIN Stop as st ON inv.custId = st.custId where inv.custNo=?]
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.parse(QueryTranslatorImpl.java:258)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
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 org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:849)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:373)
... 5 more
How should it be done join quries in hibernate?
thanks for the help in advance!
|