File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes wierd exception from hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "wierd exception from hibernate" Watch "wierd exception from hibernate" New topic
Author

wierd exception from hibernate

sweta naidu
Greenhorn

Joined: Nov 02, 2004
Posts: 25
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

Joined: Jul 11, 2001
Posts: 15299
    
    6

Moving to the ORM forum.
[ August 12, 2005: Message edited by: Gregg Bolinger ]

GenRocket - Experts at Building Test Data
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
sweta naidu
Greenhorn

Joined: Nov 02, 2004
Posts: 25
getHibernateTemplate.find()
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wierd exception from hibernate
 
Similar Threads
LazyInitializationException [spring + struts2]
Why we throw exception as we have try and catch to catch the Exception ?
hibernate dialect
Hibernate: org.springframework.beans.factory.BeanCreationException
NullPointerException when trying to run the Hibernate Example