• 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

Conversational state - Session Bean

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB Specs - Section 7.4 Conversational state says:

The conversational state of a STATEFUL session object is defined as the session bean instance�s field values, plus the transitive closure of the objects from the instance�s fields reached by following Java object references.



Can some one please explain in simple words what they mean by transitive closure of the objects? :roll: An example would be appreciated.
 
Greenhorn
Posts: 22
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Transitive closure in java parlance means recursive traversal of all objects referenced from within the bean's instance.

An example would be a Customer Session Bean with the following instance variables:Account & Profile (just consider these two instance variables as POJOs).

The Account object has the following definition:

public class Account
{
public String accountId;
public String accountName;
public Orders[] accountOrders;
public Profile aProfile;
}

public class Profile
{
public String profileId;
public String nickName;
public String preferredVendor;
}

public class Orders
{
public long orderNumber;
public String productOrdered;
private String notPartOfTransitiveClosure;

}

Transitive closure would imply that from an Account oject, say myAccount, we can do the following:

(1) You can refer to all Account object's instance variables (myAccount.accountId, myAccount.accountName,
myAccount.accountOrders, myAccount.aProfile)

(2) You can also refer to myAccount.aProfile.profileId, myAccount.aProfile.nickName, myAccount.aProfile.preferredVendor

(3) You are also able to access myAccount.[orderIndex].orderNumber, myAccount.[orderIndex].productOrdered
but, you will not be able to access myAccount.[orderIndex].notPartOfTransitiveClosure.

So, the object graph for Account object would be all the instance variables in myAccount plus recursively going through each reference (in this case, Account and Profile) to get to the lowest attribute reachable with the object reference.
 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Arun,

I am really impressed with your answer. Really Gr8!

Thanks for example. It was good one.
 
reply
    Bookmark Topic Watch Topic
  • New Topic