Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

'HOME' question

 
Terry McKee
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reviewing the EJB 2.0 specification. Throughout the spec it refers to 'home' like in the following statements:
1) Every entity object has a unique identity within its home.
2) Alternatively, if a client obtains two entity object references from the same home, it can determine if they refer to the same entity by comparing their primary keys using the equals method.
I don't understand what home means. It is not referring to the Home interface or container created class. Can anyone shed some light on this subject?
Thanks in advance.
 
Seid Myadiyev
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Terry,
I think the above talks about an instance of the bean among other instances, of the same bean, (who have the same "HomeInterface"). Also note that each deployment results in a distinct home so that holds withing a scope of the same deployment.
This is only my understanding.
What do other developers think?
+Seid
 
Terry McKee
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So does Home refer to a deployed location? If I have two servers that are part of the same application and an EJB is deployed on both of the servers - there would be two distinct home(s)?
 
Dragan Milic
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Terry McKee:
So does Home refer to a deployed location? If I have two servers that are part of the same application and an EJB is deployed on both of the servers - there would be two distinct home(s)?

Hi Terry,
Every EJB application consists of N Beans (Sesson, Entity, MDB). Each of those Beans (with exception of MDBs) gets a Home associated with it at the deployment time (that Home implements the home interface of the bean). This "home" is not location (host) dependent, it is EJB-Application dependent. That means you can have one "Home" that exists on 20 clustered servers or you can have many homes on one server. The home is a factory for the beans, so you can say that beans created by the same factory are equal if their primary keys are equal.
Dragan
 
Ashik Uzzaman
Ranch Hand
Posts: 2373
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please consider finding an error in my following statement regarding home and ejb objects.

Home objects (always implemented by container) are factory for EJB objects which in turn instantiates entity beans or session beans.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic