I am migrating hibernate 2 from hibernate 3.2.
I am using Query.creareQuery(
select distinct new com.heartbeat.profiler.commons.vo.DropdownIDValueBean(obj.id, obj.description, obj.deleteFlag)
from InteractionType as obj left outer join obj.interactions as associationObject
where ((obj.deleteFlag = 0) OR ((obj.deleteFlag = 2) AND (associationObject.id = 1196)))).setLockMode("obj", LOCKMODE.READ)
With hibernate 2 it was working fine
however for hibernate 3 it is giving me exception
java.lang.IllegalArgumentException: could not locate alias to apply lock mode : obj
at org.hibernate.loader.hql.QueryLoader.applyLocks(QueryLoader.java:297)
at org.hibernate.loader.Loader.preprocessSQL(Loader.java:201)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1538)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
Any pointers will be useful.
Thanks in advance
|