-->
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: Simple string names retrieving
PostPosted: Mon Jul 25, 2005 10:33 am 
Newbie

Joined: Mon Jul 25, 2005 10:29 am
Posts: 1
I look for a simple example on how to retrieve a List of userNames from a User object (mapped to an Oracle 9 DB). What method has the best performances to retrieve only a List of strings (I have to populate a Struts html:options tag with these names)? I have to use, query, criteria, example or other?

Thank you very much.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 25, 2005 10:44 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Code:
Query query = session.createQuery("SELECT u.name FROM User u");
List names = query.list();

Of course, you could also use hand-written SQL, but there will probably be no performance boost for such a simple example.

Best regards
Sven


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.