aspose file tools*
The moose likes Object Relational Mapping and the fly likes Mapping to Code Tables Pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Mapping to Code Tables Pattern" Watch "Mapping to Code Tables Pattern" New topic
Author

Mapping to Code Tables Pattern

Steven Martin
Greenhorn

Joined: Dec 03, 2001
Posts: 25
I've been looking for a technique to map to constant tables or what we call 'code tables'. In our website we've got many tables that just list state constants, address types, etc... It would be great to easily map from my code column associated with my JavaBean to get the actual description value. I would rather not have to create beans for every code table.

thanks,
Steven
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Using which ORM technology? Hibernate? JDO? TopLink? Or are you looking for an idea to do it in a bespoke way?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Steven Martin
Greenhorn

Joined: Dec 03, 2001
Posts: 25
Hibernate. Looks like we need a hibernate forum.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

OK. Well since this read only you safely create a view of all your config tables and map it to one Hibernate POJO. You probably then need to cache this object in you application. Something like a Singleton would do for that I'd imagine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mapping to Code Tables Pattern