• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CMR Problem

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to the EJB forum. Please continue discussing this topic there. Thank you
 
reply
    Bookmark Topic Watch Topic
  • New Topic