There is a very good chapter about @Stateful and EJB:
Stateful Session Beans
A stateful session object has a unique identity that is assigned by the container at the
time the object is created. A client of the stateful session bean business interface can
determine if two business interface or no-interface view references refer to the same
session object by use of the equals method.
For example,
@EJB Cart cart1; @EJB Cart cart2; ... if (cart1.equals(cart1)) { // this test must return
true
...
} ... if (cart1.equals(cart2)) { // this test must return false
}
...
All stateful session bean references to the same business interface for the same stateful
session bean instance will be equal. All references to the no-interface view of the same
stateful session bean instance will be equal. Stateful session bean references to
different interface types or between an interface type and a no-interface view or to
different session bean instances will not have the same identity.
Page 53,
thanks,
adam
On 17.03.2011, at 01:13, Mark Struberg wrote:
Stateless session beans are always special (because they *tataaa*
contain no state). Since CDI beans almost always contain some state info, the
'else' part of the paragraph -> return false; will always be taken.
But always returning false for all CDI beans also doesn't sound quite right to me...
There is no special paragraph about equals on Stateful session beans or EMPs in the EJB
spec, isn't?
LieGrue,
strub
--- On Wed, 3/16/11, Adam Bien <abien(a)adam-bien.com> wrote:
From: Adam Bien <abien(a)adam-bien.com>
Subject: Re: [cdi-dev] calling 'equals' on a proxy?
To: "Peter Muir" <pmuir(a)redhat.com>
Cc: "Mark Struberg" <struberg(a)yahoo.de>
Date: Wednesday, March 16, 2011, 11:51 PM
@Mark -> please file the issue.
On 17.03.2011, at 00:02, Peter Muir wrote:
Adam or mark, can you file a CDI issue to track this?
--Pete Muirhttp://in.relation.to/Bloggers/Pete
On 16 Mar 2011, at 19:06, Adam Bien <abien(a)adam-bien.com> wrote:
Equals behavior is similarly specificied in the EJB 3.1 spec. Probably we could borrow
something:
"The equals method always returns true when used to compare references to the same
business inter- face type of the same stateless session bean. The equals method always
returns true when used to com- pare references to the no-interface view of the same
stateless session bean. Stateless session bean references to either different business
interface types or between an interface type and a no-interface view or to different
session beans will not be equal." EJB 3.1, Page 54
greetings!,
adam
On 14.03.2011, at 12:52, Pete Muir wrote:
Stuart, you had this one worked out right? I believe the spec says the behaviour is
unspecified.
On 7 Mar 2011, at 15:52, Mark Struberg wrote:
Hi Pete, others!
Do you remember our discussion about what should happen if equals() gets called on a
proxy?
Should it route to the equals method of the currently proxied instance?
LieGrue,
strub
_______________________________________________
cdi-dev mailing list
cdi-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev
_______________________________________________
cdi-dev mailing list
cdi-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev
Consultant, Author, Speaker, Java Champion Weblog:
blog.adam-bien.com press:
press.adam-bien.com eMail: abien(a)adam-bien.com twitter:
twitter.com/adambien Mobile:
0049(0)170 280 3144
Author: 7 (Java SE/EE, SOA) Books, about 100 articles
Consultant, Author, Speaker, Java Champion Weblog:
blog.adam-bien.com press:
press.adam-bien.com eMail: abien(a)adam-bien.com twitter:
twitter.com/adambien Mobile:
0049(0)170 280 3144
Author: 7 (Java SE/EE, SOA) Books, about 100 articles
Mobile: 0049(0)170 280 3144
Author: 7 (Java SE/EE, SOA) Books, about 100 articles