Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

wierd exception from hibernate  RSS feed

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
select (max(cast(employer_num as bigint)) + 1) as NextNum from Employer where client_id = 97 and isNumeric(employer_num) = 1

this statement works in sql but hibernate is throwing exception like ( expected before).

any ideas
 
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the ORM forum.
[ August 12, 2005: Message edited by: Gregg Bolinger ]
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by sweta naidu:
select (max(cast(employer_num as bigint)) + 1) as NextNum from Employer where client_id = 97 and isNumeric(employer_num) = 1

this statement works in sql but hibernate is throwing exception like ( expected before).

any ideas



How are you calling your SQL? Hiberante use will of course be expecting HQL unless you explicitly tell it to run SQL.
 
sweta naidu
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getHibernateTemplate.find()
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that method is not part of the Hibernate API. I'm going to guess you are probably using Spring. If so, read the JavaDocs for HibernateTemplate.find(), particularly the bit about which language you must write your query in.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!