Win a copy of Svelte and Sapper in Action this week in the JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

CMR Problem

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I wanted to understand better how to implement CMR ( relationships in EJB ) . For a particular example of two EJBs , Bank and Branches . These two EJB have a one to many uni-directional relationship .
Bank ejb has a collection CMR field for branches and branches has a bank CMR field .
According to the Head First EJB book , fields which actually represent the relationship ( the actual foreign key field ) , must not be represented as a CMP field .

For the Branches entity , my primary key is bank code + branch code . Also bank code is a foreign key to banks table .

Now for the rules of Primary key in entity beans , all fields in Primary key , must be a CMP .
So is it correct here to represent branch code as a CMP field and ( in branches EJB ) and also have a CMR field for Banks .Is there a basic problem with this design ? .

Because for some reason , I am not able to get this relation working as it is supposed to work .
( Specially the set methods do not work as explained in the EJB spec . If I want to set all branches of a bank to another bank , the expected result is not achieved after the set operation ) . I used Websphere 5.1 for this scenario .

Please comment .

Thanks
Tarun
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the EJB forum. Please continue discussing this topic there. Thank you
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic