-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: native sql query in hibernate 3.0
PostPosted: Tue Nov 21, 2006 10:28 am 
Newbie

Joined: Wed Jan 18, 2006 2:19 pm
Posts: 14
Hi, I'm using hibernate 3.0 in a project and need to call some native sql query..

I use createSQLQuery(queryString) and in hibenrate version 3.0 I'm forced to use addScalar(String, Type) with SQLQuery.. But i query each time a different table and some tables have a string id and other have a long id. Since I don't know the id's type, I cannot use provided addScalar method.

Is there any common way to get general object type?

..i get
java.lang.UnsupportedOperationException: object is a multicolumn type
when trying to set Hibernate.OBJECT in setScalar

thx, libor


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 21, 2006 12:50 pm 
Newbie

Joined: Wed Jan 18, 2006 2:19 pm
Posts: 14
hi again,
i have just found that i can set Hibernate.STRING as a result type even if the appropriate column is of numeric type.
it's not the best solution but for now, i can't see any better and would appreciate any help :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.