• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mapping to Code Tables Pattern

 
Steven Martin
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using which ORM technology? Hibernate? JDO? TopLink? Or are you looking for an idea to do it in a bespoke way?
 
Steven Martin
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate. Looks like we need a hibernate forum.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic