Consider this (pseudo) simple table structure:
table Lookup
ID int
CODE varchar(50)
table Foo
ID int
LOOKUPID int
SOMEOTHERDATA varchar(50)
-----------------------
SELECT * FROM Lookup :
ID - CODE
2 - TOM
8 - DICK
9 - HARRY
SELECT * FROM Foo
ID - LOOKUPID - SOMEOTHERDATA
1 - 2 - BLA
2 - 2 - NI
2 - 8 - BLA BLA
2 - 9 - NI BLA
------------------------------------
Java representation:
Enumeration Lookup {
TOM, DICK, HARRY (based on values in Lookup table)
}
Class Foo {
Lookup lookup;
String someOtherData;
}
-------------------------------------
It is possible with Hibernate3 to do this nicely? The ID of the Lookup table
could be different than the enumeration ordinal..
|