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

wierd exception from hibernate

 
sweta naidu
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
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
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 ]
 
Paul Sturrock
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic