• Post Reply Bookmark Topic Watch Topic
  • New Topic

alias not found when trying to set lockmode to NONE

 
Sameer Khandekar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code to make sure that the query does not acquire an exclusive lock on the database tables.

query=session.createQuery("select count(*) from prh a " +
" where a.prn = :form_nbr " +
" and UPPER(a.gsi) = thr");
query.setLong("form_nbr",form_nbr);
query.setString("othr","OTHR");
query.setLockMode("a",LockMode.NONE);
The code compiles and builds fine, but when I run it, it throws the following exception:

exception: alias a not found

I am adding the LockMode.None to the query to avoid any kind of table locking as there is some other transaction that is expected to update the same row.

Any help in this regard with be greatly appreciated.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!