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