For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > October 2004 > How do I have to setup an EntityBean if a foreign key is referenced by a CASCADE ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How do I have to setup an EntityBean if a foreign key is referenced by a CASCADE ?
Arnold Peters

2004-10-05, 8:57 pm

Assume I defined (at least) two SQL tables. The first table contains a foreign key of the second.
The primary key of the second table is defined similar to

CREATE TABLE .....
ADD FOREIGN KEY(customer_id) REFERENCES customer (customer_id) ON DELETE CASCADE;

Pay attention to the "DELETE CASCADE". Thus if I delete a record of the second table
automatically the referenced record in the first table is deleted as well.

Ok, now I define for each of the tables (resp. possible records) an EntityBean.

What do I have to change in the setup/coding of each of the two EntityBeans in order
to treat the foreign key REFERENCE correctly?

Do I really have to do nothing more?

That would mean an EntityBean would recognize the reference by itself without help.
I cannot believe that.

Does someone have an experience with that scenario?

Arnold

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com