-->
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: retrieving results from query - error in Hibernate document?
PostPosted: Mon Jan 19, 2004 9:00 pm 
Newbie

Joined: Mon Jan 19, 2004 1:54 pm
Posts: 8
After performing the query, i got the results of type List which I call rList.
According to the top example in page 61 of the Hibernate2 Reference Documentation(pdf),
I did the following

Iterator it = rlist.iterator();
Object[] row = it.next();

...
but it.next() returns an object. The error from Eclipse shows:
type mismatch:cannot convert object to object[]

Any thoughts?

Thank you very much


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 11:14 pm 
Newbie

Joined: Mon Jan 19, 2004 1:54 pm
Posts: 8
I didn't get any reply from your gurus.
So I want to rephrase my question.
I know that HQL supports agrregate functions like count(), sum(), my problem is after executing the query, I actully want to retrieve the value of count()...
Just as I mentioned in the above question, since the count(..) is not in my persistant class, neither in a physical table, using the scalar properties mentioned in the doc. above, I couldn't even get the object[].

Pls. help if you have such experience. I think it should be very common try to retrieve the value from your queries, right?

Thks.


Top
 Profile  
 
 Post subject: Re:
PostPosted: Tue Jan 20, 2004 1:14 am 
Newbie

Joined: Thu Sep 18, 2003 1:50 am
Posts: 17
Iterator it = rlist.iterator();
Object[] row = (Object[])it.next();

(Basic Java: An array is also an Object)
- Jeevan (G1)

_________________
- Jeevan (G1)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 20, 2004 10:53 am 
Newbie

Joined: Mon Jan 19, 2004 1:54 pm
Posts: 8
g1friend,
Thank you so much. I got it right!


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.