Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate prepared statement is replacing values with question mark

 
manjesh yadav
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using Hibernate 3 with WebSphere v6 and DB2. We are having strange issue with wrong SQL prepared statements issued by Hibernate and causing syntax issues.

Good query issued by Hibernate:

SELECT * FROM rocc.Transaction t WHERE t.status_cd = 0 and t.application_cd = ? order by coalesce(t.priority,0) fetch first 25 rows only

Same query issued by Hibernate incorrectly sometimes:

SELECT * FROM rocc.Transaction t WHERE t.status_cd = ? AND t.application_cd = ? ORDER BY COALESCE(t.priority,?) FETCH first ? ROWS ONLY

It is replacing values(zero) with question mark and changing font of the keywords to uppercase (it does not matter, but mentioning here). It also changed the number 25 in fetch clause with question mark.

What is causing with the wrong prepared statement issued by Hibernate sometimes?

Hibernate is calling WSJdbcPreparedStament.executeQuery method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic