File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HIBERNATE - Populate Drop Down List Boxes?

 
Joshua White
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic