Article View: comp.lang.java.programmer
Article #270How do I have to setup an EntityBean if a foreign key is referenced by a CASCADE ?
From: Arnold Peters
Date: Tue, 05 Oct 2004 19:10
Date: Tue, 05 Oct 2004 19:10
22 lines
2243 bytes
2243 bytes
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
Technical Details
Message-ID:
<cjurie$qoc$02$1@news.t-online.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10a146,15842b7b45ac7154,start X-Google-Thread: 113ae9,15842b7b45ac7154,start X-Google-Thread: fcfbb,15842b7b45ac7154,start X-Google-Thread: f462c,15842b7b45ac7154,start X-Google-Thread: 1090f0,15842b7b45ac7154,start X-Google-Thread: 109f55,15842b7b45ac7154,start X-Google-Attributes: gid10a146,gid113ae9,gidfcfbb,gidf462c,gid1090f0,gid109f55,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: apet10@hotmail.com (Arnold Peters) Newsgroups: comp.lang.java.programmer,comp.lang.java.help,comp.lang.java.beans,ibm.software.websphere.studio,ibm.software.websphere.application-server,borland.public.jbuilder.deployment Subject: How do I have to setup an EntityBean if a foreign key is referenced by a CASCADE ? Followup-To: comp.lang.java.help Date: Tue, 5 Oct 2004 21:10:06 +0200 Organization: T-Online Lines: 23 Message-ID: <cjurie$qoc$02$1@news.t-online.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.t-online.com 1097003406 02 27404 +YDmXGprO48isyP 041005 19:10:06 X-Complaints-To: usenet-abuse@t-online.de X-ID: XdLUN-Z-ZeGv8diG-N2WcGaWENfJeMJCkM6kiNTJn1fJilxn60-S4U