• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Composite Entity

 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The composite entity pattern provides access to a coarse grained parent entity EJB that has several dependent objects. The dependent objects can be POJOs or local entity EJBs.

My doubt is that can I have a parent composite entity implemented with BMP/BMR with one of its dependent objects as another local composite entity implemented with CMP and CMR?
[ November 15, 2006: Message edited by: Durgaprasad Guduguntla ]
 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone, please help to clarify.
 
Lars Behnke
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Durgaprasad,

As far as I know you cannot mix CMT and BMT in the same transaction.

Regards,
Lars
[ November 22, 2006: Message edited by: Lars Behnke ]
 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. That means for a composite entity, if the parent entity bean is implemented with BMP then all of its dependent entity beans should be implemented with BMP. Can someone clarify whether this is correct?
 
Aleena Rehman
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Durgaprasad Guduguntla:
Thanks for the reply. That means for a composite entity, if the parent entity bean is implemented with BMP then all of its dependent entity beans should be implemented with BMP. Can someone clarify whether this is correct?


A transaction started by CMP cannot be chained into a BMP. It will be temporarily suspended till a BMP transaction is completed.

A BMP has to start its own transaction.

Please correct me if i am wrong....
 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is often confused, the question is about persistence of entity beans and not about transactions. As per EJB spec, BMT and CMT cannot be mixed and further entity beans must use CMT only. Let me make my question a bit clear - whether a BMP composite entity can have dependent local entity beans implemented with CMP.

[ November 21, 2006: Message edited by: Durgaprasad Guduguntla ]
[ November 21, 2006: Message edited by: Durgaprasad Guduguntla ]
 
Henrique Ordine
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Durgaprasad,

I don't see why not. When writing a BMP Bean you have to write the Bean persistence yourself, right? I guess you could simply have a dependent CMP bean as its dependent and use it in the BMP Bean code as you would in a Session Bean. I'm not quite sure though, I've never written a BMP Bean before. Let me know how it goes.
 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Henrique for the reply. You are right, I too don't see any problem with BMP bean accessing CMP bean as dependent object. If that is the case, there won't be any problem even if that CMP bean happens to be a composite entity implemented with CMR right?
 
Henrique Ordine
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right, I guess there won't. But like I said, don't just take it from me. Have a go at it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic