<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">There is a very good chapter about @Stateful and EJB:<div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal 'Times New Roman'; "><b>Stateful Session Beans</b></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Times New Roman'; ">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 <span style="font: 10.0px 'Courier New'">equals </span>method.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Times New Roman'; ">For example,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Courier New'; ">@EJB Cart cart1; @EJB Cart cart2; ... if (cart1.equals(cart1)) { // this test must return true</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Courier New'; ">...</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Courier New'; ">} ... if (cart1.equals(cart2)) { // this test must return false</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Courier New'; ">}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Courier New'; ">...</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Times New Roman'; ">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.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Times New Roman'; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Times New Roman'; ">Page 53,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Times New Roman'; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Times New Roman'; ">thanks,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Times New Roman'; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Times New Roman'; ">adam</div><div><div>On 17.03.2011, at 01:13, Mark Struberg wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>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 -&gt; return false; will always be taken.<br><br>But always returning false for all CDI beans also doesn't sound quite right to me... <br><br>There is no special paragraph about equals on Stateful session beans or EMPs in the EJB spec, isn't?<br><br><br>LieGrue,<br>strub<br><br>--- On Wed, 3/16/11, Adam Bien &lt;<a href="mailto:abien@adam-bien.com">abien@adam-bien.com</a>&gt; wrote:<br><br>From: Adam Bien &lt;<a href="mailto:abien@adam-bien.com">abien@adam-bien.com</a>&gt;<br>Subject: Re: [cdi-dev] calling 'equals' on a proxy?<br>To: "Peter Muir" &lt;<a href="mailto:pmuir@redhat.com">pmuir@redhat.com</a>&gt;<br>Cc: "Mark Struberg" &lt;<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>&gt;<br>Date: Wednesday, March 16, 2011, 11:51 PM<br><br>@Mark -&gt; please file the issue.<br>On 17.03.2011, at 00:02, Peter Muir wrote:<br>Adam or mark, can you file a CDI issue to track this?<br><br>--Pete <a href="Muirhttp://in.relation.to/Bloggers/Pete">Muirhttp://in.relation.to/Bloggers/Pete</a><br>On 16 Mar 2011, at 19:06, Adam Bien &lt;<a href="mailto:abien@adam-bien.com">abien@adam-bien.com</a>&gt; wrote:<br><br>Equals behavior is similarly specificied in the EJB 3.1 spec. Probably we could borrow something:<br>"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<br>greetings!,<br>adam<br>On 14.03.2011, at 12:52, Pete Muir wrote:<br>Stuart, you had this one worked out right? I believe the spec says the behaviour is unspecified.<br><br>On 7 Mar 2011, at 15:52, Mark Struberg wrote:<br><br>Hi Pete, others!<br><br>Do you remember our discussion about what should happen if equals() gets called on a proxy?<br><br>Should it route to the equals method of the currently proxied instance?<br><br>LieGrue,<br>strub<br><br><br><br>_______________________________________________<br>cdi-dev mailing list<br><a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/cdi-dev<br><br><br>_______________________________________________<br>cdi-dev mailing list<br>cdi-dev@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/cdi-dev<br><br><br>Consultant, Author, Speaker, Java Champion&nbsp;&nbsp;Weblog: blog.adam-bien.com&nbsp;press: press.adam-bien.com&nbsp;eMail: &nbsp;abien@adam-bien.com&nbsp;twitter: twitter.com/adambien&nbsp;Mobile: 0049(0)170 280 3144<br>&nbsp;Author: 7 (Java SE/EE, SOA) Books, about 100 articles&nbsp;<br><br><br><br><br><br><br><br><br><br><br><br>Consultant, Author, Speaker, Java Champion&nbsp;&nbsp;Weblog: blog.adam-bien.com&nbsp;press: press.adam-bien.com&nbsp;eMail: &nbsp;abien@adam-bien.com&nbsp;twitter: twitter.com/adambien&nbsp;Mobile: 0049(0)170 280 3144<br>&nbsp;Author: 7 (Java SE/EE, SOA) Books, about 100 articles&nbsp;<br><br><br><br><br><br><br><br><br><br><br><br><br><br></div></blockquote></div><br><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Consultant, Author, Speaker, Java Champion</div><div>&nbsp;</div><div>&nbsp;Weblog: <a href="http://blog.adam-bien.com">blog.adam-bien.com</a></div><div>&nbsp;press: <a href="http://press.adam-bien.com">press.adam-bien.com</a></div><div>&nbsp;eMail: &nbsp;<a href="mailto:abien@adam-bien.com">abien@adam-bien.com</a></div><div>&nbsp;twitter: <a href="http://twitter.com/adambien">twitter.com/adambien</a></div><div>&nbsp;Mobile: 0049(0)170 280 3144</div><div><br></div><div>&nbsp;Author: 7 (Java SE/EE, SOA) Books, about 100 articles&nbsp;</div><div><br></div></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></body></html>