How do I embed an update sql stmt into hibernate mapping file? I tried using <query/> and <sql-query/> elements but both threw an exception as -
Code:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.hibernate.hql.ast.HqlSqlWalker.postProcessUpdate(HqlSqlWalker.java:390)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:164)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:388)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:291)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
Update sql inside mapping file -
<query name="Request.getUpdateRouterFlag">
<![CDATA[UPDATE REQUEST SET RouterFlag = :inRouterFlag WHERE RequestNumber = :inRequestNumber]]>
</query>
Bulk updates are supported by HQL but couldnt find any help regarding how can we specify those SQLs inside a mapping file..
http://www.hibernate.org/hib_docs/v3/re ... tch-direct
Please help!!