-->
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.  [ 4 posts ] 
Author Message
 Post subject: Can Native Sql return Object[] type?
PostPosted: Sun Feb 20, 2005 7:28 am 
Newbie

Joined: Sun Feb 20, 2005 7:07 am
Posts: 4
I want to write a sql-query in the hbm file,
and wanted to query with a result of two columns of integer.
i.e. SELECT group_id as {i}, sum(....) as {j} from table inner join.....
And I cannot use HQL because of the formula.

I have tried to use Object[], int , java.lang.Integer in class of <return> tag, but failed. It seem only a hibernate mapping class is allowed.

Can native sql query in hibernate can do query like HQL? multiple objects and/or properties as an array of type Object[]
I read the document many times and search about it, but not found any information about this.

I am using Hibernate 2.1.7c.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 20, 2005 7:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
only in Hibernate3


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 20, 2005 10:17 am 
Newbie

Joined: Sun Feb 20, 2005 7:07 am
Posts: 4
[quote="gavin"]only in Hibernate3[/quote]

Oh.....too bad

any suggestion or work around for me??
without changing to Hibernate3


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 20, 2005 12:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
To be precise:

H2 supports return Object and Object[] but only for true entities!

H3 introduces scalar return values for createSQLQuery.

Workaround/How its done in H2: Use raw JDBC via session.connection()

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.