Here is my query:
update JSNumber set runningNo=(select runningNo +1 from JSNumber where paymentDate= '2015-07-09 00:00:00.0' ) where paymentDate = '2015-07-09 00:00:00.0'
This is working fine when I set it to a StringBuilder
sb, and run as follow:
Query query = getSession( ).createQuery( sb.toString( ) );
Here is my edited query:
select runningNo from final table (update JSNumber set runningNo=(select runningNo +1 from JSNumber where paymentDate= '2015-07-09 00:00:00.0' ) where paymentDate = '2015-07-09 00:00:00.0' )
I add in select runningNo from final table ()
in front of the original query.
This is working fine when I run it in DBVisualizer
, but when I want to run as hql, I hit
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 35
Kindly advise how to write it in hql query.