-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem retrieving query results
PostPosted: Tue Sep 11, 2007 4:57 pm 
Newbie

Joined: Tue Sep 11, 2007 2:34 pm
Posts: 5
I am using session.list() to retrieve data from DB table. Every item in the returned List is an Object[], so I need to use get[index] method to retrieve a value for the particular field. However I would prefer to use "getPropertyName" methods to obtain values for the particular fields.

Is there any way to do that?

here is my code :

[b]Iterator iter = session.createQuery("select id,description,ref1, ref2,ref3 from HibernateTest ht order by ref1").iterate();

while( iter.hasNext()){

Object[] record = (Object[])iter.next();
System.out.println("ID : " + record[0]);
.....
System.out.println("ID : " + record[10]);
}[/b]


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

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.