-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Code/decode Table to Object Mapping Best Practice
PostPosted: Fri Nov 14, 2008 5:24 pm 
Newbie

Joined: Fri Nov 14, 2008 5:05 pm
Posts: 2
Is there a best practice for mapping objects to tables for storing code/decode values? For example, I have a legacy table for Code and CodeGroup:

CODE_TAB
id numeric
code varchar
decode varchar
order numeric
codegroup numeric

CODEGROUP_TAB
id numeric
name varchar
type varchar

Stored in these tables are your common "lookup table" values that populate UI dropdowns and the like. e.g. states, country, county, yesno, etc. There are at least 100 different "lookup" types.

Object model:
Code
id Long
code String
decode String
order Integer
groupname String
grouptype String

StateCode extends Code

CountryCode extends Code

YesNo extends Code

ValidMailingAddress extends YesNo (I know this is weird but I am working with legacy data)

Object that utilizes these objects: Address

Address
id Long
street1 String
street2 String
city String
state StateCode
county CountyCode
zipcode String
country CountryCode
valid ValidMailingAddress

The values in these tables rarely change as they are really meant as lookups. I am confident that many many people have this issue but I have yet to find a decent explanation of the proper approach.

My database is pretty much unchangeable. I may more easily alter the object model as I am creating a new web-based front-end for the application.

Thank you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.