I have a native SQL query that i want to run through hibernate, but throws an error:
org.hibernate.exception.SQLGrammarException:
could not execute native bulk manipulation query
Caused by:
com.ibm.db2.jcc.am.SqlSyntaxErrorException: An unexpected token ""
was found following "". Expected tokens may include: "NQ_EXE_ID = 12345"
the code i run to perform update is:
SQLQuery updateQuery = getSession().createSQLQuery(updateSql);
System.out.println(updateQuery.getQueryString());
updateQuery.executeUpdate();
during debug i can see inside the SQLQuery object and the sql is: (which runs fine in db2)
UPDATE some_table SET DEST_FLDR = 'some_value' ,
LST_CHG_TMS = CURRENT TIMESTAMP
WHERE SUB_RUN_ID = 111111
AND INQ_EXE_ID = 12345 ;
if i manually run the sql produced by the code above, it will execute fine. However when i try to do it through hibernate it throws the 'syntaxErrorException'. Any ideas? Thanks