Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

cascade-delete doesn't work

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm using postgres 7.3.2 and jboss 3.2 and my problem is that the tag <cascade-delete/> in a one-to-many relationship doesn't work
B (1) ----- (*) A
I have my relation like this in the ejb-jar.xml
<ejb-relation> <ejb-relation-name>A-B</ejb-relation-name>
<ejb-relationship-role> <ejb-relationship-role-name>A-belongs-to-B</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<cascade-delete/>
<relationship-role-source >
<ejb-name>A</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>token</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role> <ejb-relationship-role-name>B-has-Aes</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>B</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>availabilities</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
and in the jbosscmp-jdbc.xml ...
<ejb-relation>
<ejb-relation-name>A-B</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role> <ejb-relationship-role-name>A-belongs-to-A</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role> <ejb-relationship-role-name>B-has-Aes</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>idtoken</field-name>
<column-name>id_token_fk</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
and it creates the table A in my Postgres DB like this ...
Table "public.A"
Column | Type | Modifiers
-------------+---------+-----------
id_token_fk | bigint | not null
occupation | integer | not null
Indexes: pk_A primary key btree (id_token_fk, occupation)
Foreign Key constraints: fk_useoccupation_token FOREIGN KEY (id_token_fk) REFERENCES B (id_token) ON UPDATE NO ACTION ON DELETE NO ACTION
but it should have created it with this CONSTRAINT ...
Foreign Key constraints: fk_useoccupation_token FOREIGN KEY (id_token_fk) REFERENCES B (id_token) ON UPDATE CASCADE ON DELETE NO CASCADE
It's like the tag <cascade-delete/> didn't work.
Please, I'd appreciate any help.
Thanks.
Pablo
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How was this problem solved? I met the same with you,so i want to know the answer.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic