[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2735) Query . setLockMode cannot find the alias when the query defines a select clause
Christian Beikov (JIRA)
noreply at atlassian.com
Wed Jun 15 18:38:25 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42607#action_42607 ]
Christian Beikov commented on HHH-2735:
---------------------------------------
Within a system that keeps track of versions of the data it would be really nice if this would work
expected to work: s.createQuery("select max(e.verison)+1 from entity e where id=?").setInteger(1,1).setLockMode("e", LockMode.UPGRADE).uniqueResult();
if there is any other solution than iterating over all versions and check that stuff in memory then give me a hint please.
> Query . setLockMode cannot find the alias when the query defines a select clause
> --------------------------------------------------------------------------------
>
> Key: HHH-2735
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2735
> Project: Hibernate Core
> Issue Type: Bug
> Reporter: Tamir Solomon
>
> I tried to perform the following :
> Query q1 = session.createQuery("select serverIP.server from ServerIP serverIP where serverIP.ip = :ipStr");
> q1.setLockMode("serverIP",LockMode.NONE);
> q1.setParameter("ipStr", ip);
> q1.list();
> and i get this error :
> Frame : java.lang.IllegalArgumentException: alias not found: serverIP
> at org.hibernate.loader.hql.QueryLoader.applyLocks(QueryLoader.java:299)
> at org.hibernate.loader.Loader.preprocessSQL(Loader.java:189)
> at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1529)
> at org.hibernate.loader.Loader.doQuery(Loader.java:661)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
> at org.hibernate.loader.Loader.doList(Loader.java:2211)
> at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
> at org.hibernate.loader.Loader.list(Loader.java:2090)
> at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
> 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)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list