Win a copy of Rust Web Development this week in the Other Languages 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
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Mikalai Zaikin notes -Chapter 6

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reference -Mikalai Zaikin SCBCD Notes -
Link

Chapter 6 Component Contract for CMP
3. One to Many Bidirectional relationships

entityBean_A1.setEntityBean_B(entityBean_A2.getEntityBean_B());
if (entityBean_A2.getEntityBean_B().isEmpty()) { ... } // true
if (entityBeans_B2.isEmpty()) { ... } // true
if (entityBean_B11.getEntityBean_A() == null) { ... } // true
if (entityBean_A1.isIdentical(entityBean_B21.getEntityBean_A())) {
... // true
}

I don't understand the 3'rd if that says if (entityBean_B11.getEntityBean_A() == null) { ... } // true

Why should entityBean_B11.getEntityBean_A() be null?? If it is A to B is one to many relationship I should be able to associate any any number of B's to A.
If I have B1 and B2 associated to A1 in one to many relationship in the following way
A1 --> B1
A1 --> B2

and I assign B3 to A1 it will be

A1 --> B1
A1 --> B2
A1 --> B3
B1 should not loose its association with A1.
In the above example in Mikalai zaikin's notes as far as I understand from the third if B1 looses association with A1.
Is it right or I did not understand the concept here?
[ May 01, 2004: Message edited by: Santosh Ram ]
[ May 02, 2004: Message edited by: Santosh Ram ]
 
Santosh Ramachandrula
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can some one please help me with the above questions.
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Santosh,
entityBean_A1.setEntityBean_B(entityBean_A2.getEntityBean_B());
is replacing entityBean_A1's collection of entityBean_B's with that of entityBean_A2's collection. It's not adding to it, but replacing it. So, the first collection element's are no longer associated to entityBean_A1.
I hope this clears your doubt.
 
Santosh Ramachandrula
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sany,
Thanks for the response , You made it clear to me and it makes more sense to me.
reply
    Bookmark Topic Watch Topic
  • New Topic