• Post Reply Bookmark Topic Watch Topic
  • New Topic

Composite Entity Pattern  RSS feed

 
Brian Nice
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was reading about the Composite Entity Pattern on Sun's site, but found some information elsewhere that stated that this was not a good pattern to use with EJB 2.0, but that pattern was mainly for EJb 1.x.
So does that mean using EJB 2.0 it is ok and even preferable to have your EJBs represent fine-grained objects like one EJB for each row in the database? Or is there another design pattern that one should use when using EJB 2.0 when retrieving a lot of information back from the database.
Thanks
Brian
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the motivation for the Composite Entity Pattern was that EJB 1.1 did not have the concept of local interfaces. Thus, every method call to the entity bean went through the full RMI stack causing a lot of network activity. EJB 2.0 has local interfaces which remove most of the overhead and thus reduces the need for the pattern.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Lasse is absolutley right.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB design patterns book talks about not using the pattern in EJB 2.0 spec. Please read the book for more info.
 
Brian Nice
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use local interfaces for calling all of you Entity Beans, does that mean if you have multiple machines in a cluster, and one fails, it will not be able to failover correctly since you are calling the Entity beans through local interfaces?
Thanks
Brian
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use local interfaces for calling all of you Entity Beans, does that mean if you have multiple machines in a cluster, and one fails, it will not be able to failover correctly since you are calling the Entity beans through local interfaces?

True. Cluster failover works only with remote stubs. Why would you want failover for local interfaces? If the EJB container crashes, often the web container has crashed as well.
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Brian Nice:
it will not be able to failover *correctly*

uhhm my understandng of the term "fail-over" might be wrong.
I believe it guarantees 24 X 7 X 365 availability.
So when you use the word fail-over "correctly", i agree, probably because my bean stubs are not cluster aware by virtue of being Local but that does'nt mean there will be no fail-over when you use a cluster with local interfaces. I guess nothing stops me from deploying my application with local interfaces in say various weblogic managed servers and configure the weblogic redirector (on the admin server) with the desired redirector algorithm. Am sure it will fail over when one the managed servers in the cluster goes down. If you chose to persist the session information in a persistent store (in a database / disk, which ofcourse will slow down the application), you should be able to save your current session. You might just have to repeat the action that caused one the managed server to go down. The redirector will be able to redirect the request to another server in the cluster. Thoughts?
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

EJB design patterns book talks about not using the pattern in EJB 2.0 spec.

Excuse me, Pradeep,which book are you refering to?Any links?FREE?
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vedhas Pitkar:

Excuse me, Pradeep,which book are you refering to?Any links?FREE?

Free Books
There are many (excellent) books available for free download.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!