About Question enthuware.oce-ejbd.v6.2.476 :

Moderator: admin

Post Reply
deadlock_gr
Posts: 54
Joined: Tue Apr 19, 2011 10:32 am
Contact:

About Question enthuware.oce-ejbd.v6.2.476 :

Post by deadlock_gr »

All the 3.4.5.X paragraph numbers should be changed to 3.4.7.X.

3.4.5 Session Object Identity --> 3.4.7 Session Object Identity
3.4.5.1 Stateful Session Beans --> 3.4.7.1 Stateful Session Beans
etc

P.S. I will be logging in from now on, so that you can track my posts.

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.476 :

Post by admin »

Fixed. Thanks for the feedback!
PS Please check my PM.
If you like our products and services, please help us by posting your review here.

deadlock_gr
Posts: 54
Joined: Tue Apr 19, 2011 10:32 am
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.476 :

Post by deadlock_gr »

I think that the question should be changed only for Stateful beans.

Suppose cart1 and cart2 are stateless. The .equals() method cannot guarantee whether cart1 and cart2 method calls will end up invoking the same instance from the pool. It is not even sure that all cart1 method invocations invoke the same instance. For Stateless, .equals() will always return true, no matter if different instances end up being invoked.

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.476 :

Post by admin »

Hi,

The given answer is correct. All instances of stateless beans are considered equivalent. The question says, "...object references are accessing the same bean ..." and not "...object references are accessing the same instances of the bean class...".


thank you,
Paul.
If you like our products and services, please help us by posting your review here.

snelders
Posts: 1
Joined: Sun Sep 09, 2012 2:21 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.476 :

Post by snelders »

What about stateful beans? Given the following code snippet.

@EJB Cart cart1;
@EJB Cart cart2;

Method invocations on cart1 & cart2 should be handled by the same bean instance, yet cart1.equals(cart2) is supposed to return false as described in section 3.4.7.1 of the specs.

I would also like to refer to your explanation on question 38 of Test 1 which states the same:

"References to stateful session beans are always considered different. So if you acquire the reference to the same statful session bean multiple times, all the reference are un-equal and the equals() method check will return false."

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.476 :

Post by admin »

snelders wrote:What about stateful beans? Given the following code snippet.

@EJB Cart cart1;
@EJB Cart cart2;

Method invocations on cart1 & cart2 should be handled by the same bean instance, yet cart1.equals(cart2) is supposed to return false as described in section 3.4.7.1 of the specs.

I would also like to refer to your explanation on question 38 of Test 1 which states the same:

"References to stateful session beans are always considered different. So if you acquire the reference to the same statful session bean multiple times, all the reference are un-equal and the equals() method check will return false."
Right, if the two references are pointing to a stateful bean, the equals method would tell you that they are not equal and there are not accessing the same bean. So equals method is what you should use to determine whether any two references are pointing to the same bean or not.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 41 guests