<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JAVA &#8211; James Lin&#039;s Blog</title>
	<atom:link href="https://james.lin.net.nz/category/technology/programming/java/feed/" rel="self" type="application/rss+xml" />
	<link>https://james.lin.net.nz</link>
	<description>Just bits and pieces of my life</description>
	<lastBuildDate>Fri, 19 Jan 2018 22:42:50 +0000</lastBuildDate>
	<language>en-NZ</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.2</generator>
<site xmlns="com-wordpress:feed-additions:1">22801464</site>	<item>
		<title>EJB stateful vs stateless</title>
		<link>https://james.lin.net.nz/2016/02/26/ejb-stateful-vs-stateless/</link>
		<comments>https://james.lin.net.nz/2016/02/26/ejb-stateful-vs-stateless/#respond</comments>
		<pubDate>Thu, 25 Feb 2016 20:25:38 +0000</pubDate>
		<dc:creator><![CDATA[James Lin]]></dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ejb]]></category>
		<category><![CDATA[java ee]]></category>

		<guid isPermaLink="false">http://james.lin.net.nz/?p=3765</guid>
		<description><![CDATA[I have been studying Java EE and I posted a question on Stackoverflow to verify my understanding of &#8220;SessionBean&#8221;, here is the summary: Stateless bean in client: [crayon-5a66473513908712477343/] &#160; Stateful bean in client: [crayon-5a66473513928265686067/] &#160; A stateless session bean, should not store a state in the bean instance, in order words, it&#8217;s class members should… <span class="read-more"><a href="https://james.lin.net.nz/2016/02/26/ejb-stateful-vs-stateless/">Read More &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>I have been studying Java EE and I posted a <a href="http://stackoverflow.com/questions/35616897/when-bean-null-does-the-app-server-trash-the-stateful-bean-instance-and-create" target="_blank">question</a> on Stackoverflow to verify my understanding of &#8220;SessionBean&#8221;, here is the summary:</p>
<p>Stateless bean in client:</p><pre class="crayon-plain-tag">public void work(){
    bean.work1();   // this uses instance 1 in App Server
    ...
    bean.work2();   // this can be instance 2 in App Server
}</pre><p>&nbsp;</p>
<p>Stateful bean in client:</p><pre class="crayon-plain-tag">public void work(){
    bean.add_item(item); // this uses instance 1 in App Server
    ....
    bean.checkout();     // this uses instance 1 in App Server
}</pre><p>&nbsp;</p>
<ul>
<li>A stateless session bean, should not store a state in the bean instance, in order words, it&#8217;s class members should not be assigned by external values.</li>
<li>A stateful session bean, maintains it&#8217;s state until it&#8217;s &#8220;flushed&#8221;, a bean method that is annotated by &#8220;@Remove&#8221;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://james.lin.net.nz/2016/02/26/ejb-stateful-vs-stateless/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<post-id xmlns="com-wordpress:feed-additions:1">3765</post-id>	</item>
	</channel>
</rss>
