-->
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.  [ 2 posts ] 
Author Message
 Post subject: Code Tables in Legacy System
PostPosted: Mon Aug 23, 2004 12:01 am 
Newbie

Joined: Mon Aug 09, 2004 4:28 am
Posts: 18
Location: Australia
I have read Hibernate in Action and tried looking on this forum, however, I am still confused with how to map a code table ..........

I have a client table and associated class.

That table has a foreign key to a code (lookup) table.

For example :

Code:
CREATE TABLE cl_client
(c_client char(10) NOT NULL NOT DEFAULT
, c_group char(10) WITH NULL
                 etc


Foreign Key Constraint :

Code:
ALTER TABLE cl_client ADD CONSTRAINT cl_client_fk_1
            FOREIGN KEY (c_group) REFERENCES cl_group


Code (Lookup Table) :

Code:
CREATE TABLE cl_group
(c_group char(10) NOT NULL NOT DEFAULT
, t_group char(30) NOT NULL NOT DEFAULT
, f_obsolete (char 1) NOT NULL NOT DEFAULT



I want to modify the ClClient class so that when it does a read or a list, it does a left join from the cl_client table to cl_group table and gets the text t_group for the specified c_group.

The cl_group table also has a life of its own (entries can be created, deleted, and updated etc) .....

What is the best way to map the association between the c_group column/field in the cl_client table and the cl_group table.

Thanks for your help,

Mike


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 23, 2004 6:27 am 
Regular
Regular

Joined: Wed Aug 18, 2004 5:16 am
Posts: 69
Location: Modena, Italy
Create a reference to a group object in client class and map this as many-to-one in client class mapping


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

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.