• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

createNativeQuery causing SQL syntax error

 
Amy Saari
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All

This took a bit to figure out so I thought I would share.



See that # - if you're using toplink you want the # for a named substitution BUT if you're using hibernate you want a :
and somefield is a string in the above - you don't need to wrap it in quotes. toplink at least will figure it out.

sheesh....that su...ed...and yes i know, i know, blah, blah, blah....don't use native queries...more blahs...
hope the above is helpful....

Amy
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parameters are meant to be indexed in JPA native SQL queries using the "?" marker.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic