This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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.
 
Don't get me started about those stupid light bulbs.
 
subject: Mapping to Code Tables Pattern
 
Similar Threads
ORM Mapping, Best practices?
Problem with displaying an histogramm with Cewolf
How to implement a "data model"
How to convert HashMap to JavaBean
using attributes from different tables in the mapping/annotation