-->
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: mapping for legacy database
PostPosted: Wed May 12, 2010 4:34 am 
Newbie

Joined: Wed Mar 03, 2010 5:51 am
Posts: 4
i have scenario like below


schema:
create table MasterTable(
id INTEGER NOT NULL,
strucid INTEGER NOT NULL,
fname VARCHAR(25) NOT NULL,
mname VARCHAR(25) NOT NULL,
lname VARCHAR(25) NOT NULL,
city VARCHAR(25) NOT NULL,
pin INTEGER NOT NULL,
PRIMARY KEY (id)
);

ALTER TABLE MasterTable
ADD CONSTRAINT Master_uk UNIQUE
(
fname,
mname,
lname,
city,
pin
);

create table SlaveTable(
strucid INTEGER NOT NULL,
fname VARCHAR(25) NOT NULL,
mname VARCHAR(25) NOT NULL,
lname VARCHAR(25) NOT NULL,
city VARCHAR(25) NOT NULL,
pin INTEGER NOT NULL,

PRIMARY KEY
(
strucid,
fname ,
mname ,
lname ,
city ,
pin
)
);



ALTER TABLE SlaveTable
ADD CONSTRAINT Slave_FK FOREIGN KEY
(
strucid,
fname ,
mname ,
lname ,
city ,
pin
)
REFERENCES MasterTable
(
strucid,
fname ,
mname ,
lname ,
city ,
pin
);

how to write mapping for tables??? and how to insert data into the tables by using cascade

_________________
dsvk


Top
 Profile  
 
 Post subject: Re: mapping for legacy database
PostPosted: Wed May 12, 2010 4:47 am 
Newbie

Joined: Wed Mar 03, 2010 5:51 am
Posts: 4
dsvk wrote:
i have scenario like below


schema:
create table MasterTable(
id INTEGER NOT NULL,
strucid INTEGER NOT NULL,
fname VARCHAR(25) NOT NULL,
mname VARCHAR(25) NOT NULL,
lname VARCHAR(25) NOT NULL,
city VARCHAR(25) NOT NULL,
pin INTEGER NOT NULL,
PRIMARY KEY (id)
);

ALTER TABLE MasterTable
ADD CONSTRAINT Master_uk UNIQUE
(
fname,
mname,
lname,
city,
pin
);

create table SlaveTable(
strucid INTEGER NOT NULL,
fname VARCHAR(25) NOT NULL,
mname VARCHAR(25) NOT NULL,
lname VARCHAR(25) NOT NULL,
city VARCHAR(25) NOT NULL,
pin INTEGER NOT NULL,

PRIMARY KEY
(
strucid,
fname ,
mname ,
lname ,
city ,
pin
)
);



ALTER TABLE SlaveTable
ADD CONSTRAINT Slave_FK FOREIGN KEY
(
strucid,
fname ,
mname ,
lname ,
city ,
pin
)
REFERENCES MasterTable
(
strucid,
fname ,
mname ,
lname ,
city ,
pin
);

how to write mapping for tables??? and how to insert data into the tables by using cascade

_________________
dsvk


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.