• 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

Relationship between CMP and BMP entity

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


I have been reading about CMR and there is one question I could not find an explicit answer to and this is how to support relations between CMP and BMP entity beans. As I can see it there are no restrictions here so any of the following is possible:
1. a uni-directional relation from a CMP to a BMP entity bean
2. a uni-directional relation from a BMP to a CMP entity bean
3. a bi-directional relation between a CMP and BMP entity bean
Of course, also in all variants: one-to-one, one-to-many, many-to-one, many-to-many.

Can anyone confirm this?

Cheers
Erik
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Erik:
Hi,


I have been reading about CMR and there is one question I could not find an explicit answer to and this is how to support relations between CMP and BMP entity beans. As I can see it there are no restrictions here so any of the following is possible:
1. a uni-directional relation from a CMP to a BMP entity bean
2. a uni-directional relation from a BMP to a CMP entity bean
3. a bi-directional relation between a CMP and BMP entity bean
Of course, also in all variants: one-to-one, one-to-many, many-to-one, many-to-many.

Can anyone confirm this?

Cheers
Erik




Hi Erik,

I am not sure from where you have read that any type of relationship ( 1->1 or 1->many or Many->Many) between BMP and CMP is possible.

EJB specification clearly says that relationships between entity beans can be managed (Transparently) by the Container ONLY when the persistence is Container Managed. This would provide the visibility to the Container to understand how the tables of the entity beans involved in relationships, mapped at the database end , by which it can transparently manage the relationships.


You can certainly have one or more BMP entity beans as a instance variable of CMP bean and vice versa but you will not be able to get the transparent relationship management ( For ex: when a child entity bean is added/deleted - adding or deleting it at the database end) provided by the Container as Container will not have the visibility to the BMP bean and the table it is mapped to( Note that all the Persitence code has to be written inside the bean itself).

Please read the section "10.3.2 The Entity Bean Provider�s View of Persistent Relationships" for more details on the entity bean relationship.

Regards
Karim
 
Erik Brakkee
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Karim,


I didn't actually read anywhere that this was possible, but could find any place that said it wasn't. Anyway, your reply clarifies a lot.

Thanks
Erik
 
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic