• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

relationships using composite keys

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two beans (A and B) and their associated tables are defined as:
[table A]
name varchar
id integer
other columns...
primarykey is (name, id) which is defined as APK.class
[table B]
name varchar
id integer
bname varchar
other columns...
primarykey is (name, id, bname) which is defined as BPK.class
Question: How do I setup the relationship between A and B to perform
cascade delete (i.e. deleting A would automatically delete associated
B)? The database tables (oracle) are already setup to do cascade delete.
I've tried this but get an error when running appc (In relationship 'A-
B', role 'B-Has-One-A', a cmp-field used to implement this relationship
has a primitive type. All cmp-fields that double as cmr-fields must have
an object type.)
in ejb-jar.xml:
in weblogic-ejb-jar.xml:
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I would presume that doing findbyPrimaryKey(PKClass pk)
and then doing a remove() on the interface would do it?
Anyway I started using entity beans with CMP/CMR a few weeks ago. I would be interested in collaborating on this.
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic