-->
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: Enum to lookup table
PostPosted: Wed Oct 12, 2005 12:13 pm 
Newbie

Joined: Wed Oct 12, 2005 12:00 pm
Posts: 1
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..


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.