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.
|