aspose file tools*
The moose likes Object Relational Mapping and the fly likes HIBERNATE - Populate Drop Down List Boxes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HIBERNATE - Populate Drop Down List Boxes?" Watch "HIBERNATE - Populate Drop Down List Boxes?" New topic
Author

HIBERNATE - Populate Drop Down List Boxes?

Joshua White
Ranch Hand

Joined: Jun 04, 2001
Posts: 97
As an example, say I deal with "Person" objects. This object may have 10-15 attributes. For conversations sake, I have successfully configured my mapping for this "Person" object.

Say I would like to integrate with struts and I would like to create a drop down list box of all the unique names from these "Person" objects. How would this be done? Does it make sense to create a collection of "Person" objecs or should I map some sort of name/value pair object?

Suggestions would be appreciated.

Regards,

Joshua
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Its up to you really. Passing a collection of POJO's with more attributes than your view code needs is only really an issue if you are passing them over a network and ther POJO are quite big, since the server will have to serialize/deserialize them. Alteratively if you already have a collection of POJO's (as you will have from a hibernate query) its extra work turning this into another collection. Of course this also somewhat ignores the benefits of caching Hibernate can provide.

If you are really worried about performance and its a ver common requirement, you could map another object which is just the value you want. This is a little redundant though.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HIBERNATE - Populate Drop Down List Boxes?