<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Middleware Technologies [MCA II Yr, Anna University] by Roy Antony Arnold</title>
	<atom:link href="http://middlewares.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://middlewares.wordpress.com</link>
	<description>Lecturer, Panimalar Engineering College</description>
	<lastBuildDate>Sun, 31 Jul 2011 17:35:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='middlewares.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Middleware Technologies [MCA II Yr, Anna University] by Roy Antony Arnold</title>
		<link>http://middlewares.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://middlewares.wordpress.com/osd.xml" title="Middleware Technologies [MCA II Yr, Anna University] by Roy Antony Arnold" />
	<atom:link rel='hub' href='http://middlewares.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Sample Programs for Middleware</title>
		<link>http://middlewares.wordpress.com/2010/09/19/sample-programs-for-middleware/</link>
		<comments>http://middlewares.wordpress.com/2010/09/19/sample-programs-for-middleware/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 09:05:10 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/?p=255</guid>
		<description><![CDATA[Bank Bean: http://www.4shared.com/file/MS3O7cYT/Bank_Bean.html BANK Operations: http://www.4shared.com/document/7cgKH2qN/BANK_Operations.html Using BDK: http://www.4shared.com/document/4FkRONc5/bdk.html Book Bean: http://www.4shared.com/file/0-_paXlp/Book_Bean.html C#  Programs http://www.4shared.com/document/tViFmNpY/C_programs.html CORBA Programs: http://www.4shared.com/document/oMKlkUQH/CORBA_Programs.html Hello Bean: http://www.4shared.com/file/FFQzOpo5/Hello_Bean.html Library: http://www.4shared.com/document/XMzsABS1/LIB.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=255&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">Bank Bean:</div>
<p><a title="Bank Bean" href="http://www.4shared.com/file/MS3O7cYT/Bank_Bean.html" target="_blank">http://www.4shared.com/file/MS3O7cYT/Bank_Bean.html</a></p>
<p>BANK Operations:</p>
<p><a title="Bank Operations" href="http://www.4shared.com/document/7cgKH2qN/BANK_Operations.html" target="_blank">http://www.4shared.com/document/7cgKH2qN/BANK_Operations.html</a></p>
<p>Using BDK:</p>
<p><a title="Using BDK" href="http://www.4shared.com/document/4FkRONc5/bdk.html" target="_blank">http://www.4shared.com/document/4FkRONc5/bdk.html</a></p>
<p>Book Bean:</p>
<p><a title="Book Bean" href="http://www.4shared.com/file/0-_paXlp/Book_Bean.html" target="_blank">http://www.4shared.com/file/0-_paXlp/Book_Bean.html</a></p>
<p>C#  Programs</p>
<p><a title="C# Programs" href="http://www.4shared.com/document/tViFmNpY/C_programs.html" target="_blank">http://www.4shared.com/document/tViFmNpY/C_programs.html</a></p>
<p>CORBA Programs:</p>
<p><a title="CORBA Programs" href="http://www.4shared.com/document/oMKlkUQH/CORBA_Programs.html" target="_blank">http://www.4shared.com/document/oMKlkUQH/CORBA_Programs.html</a></p>
<p>Hello Bean:</p>
<p><a title="Hello Bean" href="http://www.4shared.com/file/FFQzOpo5/Hello_Bean.html" target="_blank">http://www.4shared.com/file/FFQzOpo5/Hello_Bean.html</a></p>
<p>Library:</p>
<p><a title="Library" href="http://www.4shared.com/document/XMzsABS1/LIB.html" target="_blank">http://www.4shared.com/document/XMzsABS1/LIB.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/255/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=255&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2010/09/19/sample-programs-for-middleware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
		<item>
		<title>Lecture Slides for Middleware</title>
		<link>http://middlewares.wordpress.com/2010/09/19/lecture-slides-for-middleware/</link>
		<comments>http://middlewares.wordpress.com/2010/09/19/lecture-slides-for-middleware/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 08:54:03 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[Slides]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/?p=252</guid>
		<description><![CDATA[Click the link http://www.4shared.com/dir/Veur7v-E/Slides.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=252&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Click the link</p>
<h2><a title="Middleware Slides" href="http://www.4shared.com/dir/Veur7v-E/Slides.html" target="_blank"><span style="color:#888888;">http://www.4shared.com/dir/Veur7v-E/Slides.html</span></a></h2>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/252/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=252&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2010/09/19/lecture-slides-for-middleware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
		<item>
		<title>Using BEA Weblogic Server &#8211; Demos</title>
		<link>http://middlewares.wordpress.com/2010/09/19/using-bea-weblogic-server-demos/</link>
		<comments>http://middlewares.wordpress.com/2010/09/19/using-bea-weblogic-server-demos/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 08:50:48 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[EJB]]></category>
		<category><![CDATA[Practical]]></category>
		<category><![CDATA[Demos]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/?p=248</guid>
		<description><![CDATA[Some Demos using BEA Weblogic Server http://www.4shared.com/file/jgwM9ERU/Changing_JNDI_Name_of_a_Bean.html http://www.4shared.com/file/ZBY-fGHa/Creating_a_Connection_Pool_for.html http://www.4shared.com/file/JTU-bHHp/Creating_a_Data_Source_for_Ent.html http://www.4shared.com/file/4zWYuLEu/Creating_Bank_JAR_for_Entity_B.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=248&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Some Demos using BEA Weblogic Server</p>
<p><a title="Demo - Changing JNDI Name of a Bean" href="http://www.4shared.com/file/jgwM9ERU/Changing_JNDI_Name_of_a_Bean.html" target="_blank">http://www.4shared.com/file/jgwM9ERU/Changing_JNDI_Name_of_a_Bean.html</a></p>
<p><a title="Creating a Connection Pool" href="http://www.4shared.com/file/ZBY-fGHa/Creating_a_Connection_Pool_for.html" target="_blank">http://www.4shared.com/file/ZBY-fGHa/Creating_a_Connection_Pool_for.html</a></p>
<p><a title="Creating Data Source for Entity Bean" href="http://www.4shared.com/file/JTU-bHHp/Creating_a_Data_Source_for_Ent.html" target="_blank">http://www.4shared.com/file/JTU-bHHp/Creating_a_Data_Source_for_Ent.html</a></p>
<p><a title="Creating JAR for Entity Bean" href="http://www.4shared.com/file/4zWYuLEu/Creating_Bank_JAR_for_Entity_B.html" target="_blank">http://www.4shared.com/file/4zWYuLEu/Creating_Bank_JAR_for_Entity_B.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/248/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=248&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2010/09/19/using-bea-weblogic-server-demos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
		<item>
		<title>Stateful Session Bean Lifecycle: PrePassivate</title>
		<link>http://middlewares.wordpress.com/2009/08/09/stateful-session-bean-lifecycle-prepassivate/</link>
		<comments>http://middlewares.wordpress.com/2009/08/09/stateful-session-bean-lifecycle-prepassivate/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 17:16:49 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[JBoss]]></category>
		<category><![CDATA[Session]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/?p=244</guid>
		<description><![CDATA[File: Employee.java import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.PostRemove; @Entity public class Employee implements java.io.Serializable { private int id; private String firstName; private String lastName; @Id @GeneratedValue public int getId() { return id; } @PostRemove public void postRemove() { System.out.println(&#8220;@PostRemove&#8221;); } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String first) { this.firstName = first; } [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=244&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:0;font-size:13px;white-space:nowrap;"><span style="color:#000000;">File: Employee.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Entity;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.EntityListeners;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.GeneratedValue;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Id;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.PostRemove;</span></p>
<p><span style="color:#000000;">@Entity</span></p>
<p><span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">Employee </span><span style="color:#7f0055;"><strong>implements </strong></span><span style="color:#000000;">java.io.Serializable </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">String firstName;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">String lastName;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Id</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">@GeneratedValue</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">getId</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@PostRemove</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">postRemove</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;@PostRemove&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setId</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.id = id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">String getFirstName</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">firstName;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setFirstName</span><span style="color:#000000;">(</span><span style="color:#000000;">String first</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.firstName = first;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">String getLastName</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">lastName;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setLastName</span><span style="color:#000000;">(</span><span style="color:#000000;">String last</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.lastName = last;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: EmployeeBean.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.PrePassivate;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Stateful;</span></p>
<p><span style="color:#000000;">@Stateful</span><br />
<span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">EmployeeBean </span><span style="color:#7f0055;"><strong>implements </strong></span><span style="color:#000000;">EmployeeServiceLocal, EmployeeServiceRemote </span><span style="color:#000000;">{</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">EmployeeBean</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">doAction</span><span style="color:#000000;">(){</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;doAction&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@PrePassivate</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">PrePassivate</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;PrePassivate&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: EmployeeServiceLocal.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.Map;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Local;</span></p>
<p><span style="color:#000000;">@Local</span><br />
<span style="color:#7f0055;"><strong>public interface </strong></span><span style="color:#000000;">EmployeeServiceLocal </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">doAction</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: EmployeeServiceRemote.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Remote;</span></p>
<p><span style="color:#000000;">@Remote</span><br />
<span style="color:#7f0055;"><strong>public interface </strong></span><span style="color:#000000;">EmployeeServiceRemote </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">doAction</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: jndi.properties</span></p>
<p><span style="color:#000000;">java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory</span><br />
<span style="color:#000000;">java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces</span><br />
<span style="color:#000000;">java.naming.provider.url=localhost:</span><span style="color:#990000;">1099</span></p>
<p><span style="color:#000000;">File: Main.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.EJB;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.naming.InitialContext;</span></p>
<p><span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">Main </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public static </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">main</span><span style="color:#000000;">(</span><span style="color:#000000;">String</span><span style="color:#000000;">[] </span><span style="color:#000000;">a</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception </span><span style="color:#000000;">{</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">EmployeeServiceRemote service = </span><span style="color:#7f0055;"><strong>null</strong></span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">// Context compEnv = (Context) new InitialContext().lookup(&#8220;java:comp/env&#8221;);</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">// service = (HelloService)new InitialContext().lookup(&#8220;java:comp/env/ejb/HelloService&#8221;);</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">service = </span><span style="color:#000000;">(</span><span style="color:#000000;">EmployeeServiceRemote</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">InitialContext</span><span style="color:#000000;">()</span><span style="color:#000000;">.lookup</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;EmployeeBean/remote&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">service.doAction</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">}</span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/244/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=244&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2009/08/09/stateful-session-bean-lifecycle-prepassivate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
		<item>
		<title>EJB Tutorial from JBoss: Stateful Session Bean</title>
		<link>http://middlewares.wordpress.com/2009/08/07/ejb-tutorial-from-jboss-stateful-session-bean/</link>
		<comments>http://middlewares.wordpress.com/2009/08/07/ejb-tutorial-from-jboss-stateful-session-bean/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 18:24:57 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[JBoss]]></category>
		<category><![CDATA[Programs]]></category>
		<category><![CDATA[Session]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/2009/08/07/ejb-tutorial-from-jboss-stateful-session-bean/</guid>
		<description><![CDATA[File: ShoppingCart.java /* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.tutorial.stateful.bean; import java.util.HashMap; import javax.ejb.Remove; public interface ShoppingCart { void buy(String product, int quantity); HashMap&#60;String, Integer&#62; getCartContents(); @Remove void checkout(); } File: ShoppingCartBean.java /* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=243&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:0;font-size:13px;white-space:nowrap;"><span style="color:#000000;">File: ShoppingCart.java</span></p>
<p><span style="color:#3f7f5f;">/*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* JBoss, Home of Professional Open Source.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Copyright 2006, Red Hat Middleware LLC, and individual contributors</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* as indicated by the @author tags. See the copyright.txt file in the</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* distribution for a full listing of individual contributors.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This is free software; you can redistribute it and/or modify it</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* under the terms of the GNU Lesser General Public License as</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* published by the Free Software Foundation; either version 2.1 of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* the License, or (at your option) any later version.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This software is distributed in the hope that it will be useful,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Lesser General Public License for more details.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* You should have received a copy of the GNU Lesser General Public</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* License along with this software; if not, write to the Free</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* 02110-1301 USA, or see the FSF site: http://www.fsf.org.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*/</span><br />
<span style="color:#7f0055;"><strong>package </strong></span><span style="color:#000000;">org.jboss.tutorial.stateful.bean;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.HashMap;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Remove;</span></p>
<p><span style="color:#7f0055;"><strong>public interface </strong></span><span style="color:#000000;">ShoppingCart</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">buy</span><span style="color:#000000;">(</span><span style="color:#000000;">String product, </span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">quantity</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">HashMap&lt;String, Integer&gt; getCartContents</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Remove </span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">checkout</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: ShoppingCartBean.java</span></p>
<p><span style="color:#3f7f5f;">/*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* JBoss, Home of Professional Open Source.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Copyright 2006, Red Hat Middleware LLC, and individual contributors</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* as indicated by the @author tags. See the copyright.txt file in the</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* distribution for a full listing of individual contributors.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This is free software; you can redistribute it and/or modify it</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* under the terms of the GNU Lesser General Public License as</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* published by the Free Software Foundation; either version 2.1 of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* the License, or (at your option) any later version.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This software is distributed in the hope that it will be useful,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Lesser General Public License for more details.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* You should have received a copy of the GNU Lesser General Public</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* License along with this software; if not, write to the Free</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* 02110-1301 USA, or see the FSF site: http://www.fsf.org.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*/</span><br />
<span style="color:#7f0055;"><strong>package </strong></span><span style="color:#000000;">org.jboss.tutorial.stateful.bean;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.io.Serializable;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.HashMap;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Remove;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Stateful;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Remote;</span></p>
<p><span style="color:#000000;">@Stateful</span><br />
<span style="color:#000000;">@Remote</span><span style="color:#000000;">(</span><span style="color:#000000;">ShoppingCart.</span><span style="color:#7f0055;"><strong>class</strong></span><span style="color:#000000;">)</span><br />
<span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">ShoppingCartBean </span><span style="color:#7f0055;"><strong>implements </strong></span><span style="color:#000000;">ShoppingCart, Serializable</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">HashMap&lt;String, Integer&gt; cart = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">HashMap&lt;String, Integer&gt;</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">buy</span><span style="color:#000000;">(</span><span style="color:#000000;">String product, </span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">quantity</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>if </strong></span><span style="color:#000000;">(</span><span style="color:#000000;">cart.containsKey</span><span style="color:#000000;">(</span><span style="color:#000000;">product</span><span style="color:#000000;">))</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">currq = cart.get</span><span style="color:#000000;">(</span><span style="color:#000000;">product</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">currq += quantity;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">cart.put</span><span style="color:#000000;">(</span><span style="color:#000000;">product, currq</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>else</strong></span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">cart.put</span><span style="color:#000000;">(</span><span style="color:#000000;">product, quantity</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">HashMap&lt;String, Integer&gt; getCartContents</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">cart;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Remove</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">checkout</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;To be implemented&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: Client.java</span></p>
<p><span style="color:#3f7f5f;">/*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* JBoss, Home of Professional Open Source.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Copyright 2006, Red Hat Middleware LLC, and individual contributors</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* as indicated by the @author tags. See the copyright.txt file in the</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* distribution for a full listing of individual contributors.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This is free software; you can redistribute it and/or modify it</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* under the terms of the GNU Lesser General Public License as</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* published by the Free Software Foundation; either version 2.1 of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* the License, or (at your option) any later version.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This software is distributed in the hope that it will be useful,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Lesser General Public License for more details.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* You should have received a copy of the GNU Lesser General Public</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* License along with this software; if not, write to the Free</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* 02110-1301 USA, or see the FSF site: http://www.fsf.org.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*/</span><br />
<span style="color:#7f0055;"><strong>package </strong></span><span style="color:#000000;">org.jboss.tutorial.stateful.client;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.HashMap;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.naming.InitialContext;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">org.jboss.tutorial.stateful.bean.ShoppingCart;</span></p>
<p><span style="color:#3f5fbf;">/**</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* Comment</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@author </span><span style="color:#3f5fbf;">&lt;a href=&#8221;mailto:bill@jboss.org&#8221;&gt;Bill Burke&lt;/a&gt;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@version </span><span style="color:#3f5fbf;">$Revision: 57207 $</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*/</span><br />
<span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">Client</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public static </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">main</span><span style="color:#000000;">(</span><span style="color:#000000;">String</span><span style="color:#000000;">[] </span><span style="color:#000000;">args</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">InitialContext ctx = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">InitialContext</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">ShoppingCart cart = </span><span style="color:#000000;">(</span><span style="color:#000000;">ShoppingCart</span><span style="color:#000000;">) </span><span style="color:#000000;">ctx.lookup</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;ShoppingCartBean/remote&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Buying 1 memory stick&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">cart.buy</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Memory stick&#8221;</span><span style="color:#000000;">, </span><span style="color:#990000;">1</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Buying another memory stick&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">cart.buy</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Memory stick&#8221;</span><span style="color:#000000;">, </span><span style="color:#990000;">1</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Buying a laptop&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">cart.buy</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Laptop&#8221;</span><span style="color:#000000;">, </span><span style="color:#990000;">1</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Print cart:&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">HashMap&lt;String, Integer&gt; fullCart = cart.getCartContents</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>for </strong></span><span style="color:#000000;">(</span><span style="color:#000000;">String product : fullCart.keySet</span><span style="color:#000000;">())</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#000000;">fullCart.get</span><span style="color:#000000;">(</span><span style="color:#000000;">product</span><span style="color:#000000;">) </span><span style="color:#000000;">+ </span><span style="color:#2a00ff;">&#8220;     &#8221; </span><span style="color:#000000;">+ product</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Checkout&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">cart.checkout</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Should throw an object not found exception by invoking on cart after @Remove method&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>try</strong></span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">cart.getCartContents</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>catch </strong></span><span style="color:#000000;">(</span><span style="color:#000000;">javax.ejb.EJBNoSuchObjectException e</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;Successfully caught no such object exception.&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">}</span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/243/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=243&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2009/08/07/ejb-tutorial-from-jboss-stateful-session-bean/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
		<item>
		<title>EJB Tutorial from JBoss: Entity with Blob data</title>
		<link>http://middlewares.wordpress.com/2009/08/05/ejb-tutorial-from-jboss-entity-with-blob-data/</link>
		<comments>http://middlewares.wordpress.com/2009/08/05/ejb-tutorial-from-jboss-entity-with-blob-data/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 03:33:17 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[JBoss]]></category>
		<category><![CDATA[Programs]]></category>
		<category><![CDATA[Entity]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/?p=240</guid>
		<description><![CDATA[Entity Bean with Blob Data File: BlobEntity.java /* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.tutorial.blob.bean; import java.io.Serializable; import java.sql.Blob; import java.sql.Clob; import javax.persistence.Basic; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Lob; /** * Comment * * @author &#60;a href=&#8221;mailto:bill@jboss.org&#8221;&#62;Bill Burke&#60;/a&#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=240&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="text-align:center;">Entity Bean with Blob Data</h2>
<p><span style="font-family:0;font-size:13px;white-space:nowrap;"><span style="color:#000000;">File: BlobEntity.java</span></p>
<p><span style="color:#3f7f5f;">/*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* JBoss, Home of Professional Open Source.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Copyright 2006, Red Hat Middleware LLC, and individual contributors</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* as indicated by the @author tags. See the copyright.txt file in the</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* distribution for a full listing of individual contributors.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This is free software; you can redistribute it and/or modify it</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* under the terms of the GNU Lesser General Public License as</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* published by the Free Software Foundation; either version 2.1 of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* the License, or (at your option) any later version.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This software is distributed in the hope that it will be useful,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Lesser General Public License for more details.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* You should have received a copy of the GNU Lesser General Public</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* License along with this software; if not, write to the Free</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* 02110-1301 USA, or see the FSF site: http://www.fsf.org.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*/</span><br />
<span style="color:#7f0055;"><strong>package </strong></span><span style="color:#000000;">org.jboss.tutorial.blob.bean;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.io.Serializable;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.sql.Blob;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.sql.Clob;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Basic;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Entity;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.FetchType;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.GeneratedValue;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.GenerationType;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Id;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Lob;</span></p>
<p><span style="color:#3f5fbf;">/**</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* Comment</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@author </span><span style="color:#3f5fbf;">&lt;a href=&#8221;mailto:bill@jboss.org&#8221;&gt;Bill Burke&lt;/a&gt;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@version </span><span style="color:#3f5fbf;">$Revision: 57207 $</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*/</span><br />
<span style="color:#000000;">@Entity</span><br />
<span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">BlobEntity </span><span style="color:#7f0055;"><strong>implements </strong></span><span style="color:#000000;">Serializable</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">Blob blobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">Clob clobby;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Id @GeneratedValue</span><span style="color:#000000;">(</span><span style="color:#000000;">strategy=GenerationType.IDENTITY</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">getId</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setId</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.id = id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Lob @Basic</span><span style="color:#000000;">(</span><span style="color:#000000;">fetch = FetchType.EAGER</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Blob getBlobby</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">blobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setBlobby</span><span style="color:#000000;">(</span><span style="color:#000000;">Blob blobby</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.blobby = blobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Lob @Basic</span><span style="color:#000000;">(</span><span style="color:#000000;">fetch = FetchType.EAGER</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Clob getClobby</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">clobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setClobby</span><span style="color:#000000;">(</span><span style="color:#000000;">Clob clobby</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.clobby = clobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: LobTester.java</span></p>
<p><span style="color:#3f7f5f;">/*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* JBoss, Home of Professional Open Source.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Copyright 2006, Red Hat Middleware LLC, and individual contributors</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* as indicated by the @author tags. See the copyright.txt file in the</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* distribution for a full listing of individual contributors.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This is free software; you can redistribute it and/or modify it</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* under the terms of the GNU Lesser General Public License as</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* published by the Free Software Foundation; either version 2.1 of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* the License, or (at your option) any later version.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This software is distributed in the hope that it will be useful,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Lesser General Public License for more details.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* You should have received a copy of the GNU Lesser General Public</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* License along with this software; if not, write to the Free</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* 02110-1301 USA, or see the FSF site: http://www.fsf.org.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*/</span><br />
<span style="color:#7f0055;"><strong>package </strong></span><span style="color:#000000;">org.jboss.tutorial.blob.bean;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.HashMap;</span></p>
<p><span style="color:#3f5fbf;">/**</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* Comment</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@author </span><span style="color:#3f5fbf;">&lt;a href=&#8221;mailto:bill@jboss.org&#8221;&gt;Bill Burke&lt;/a&gt;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@version </span><span style="color:#3f5fbf;">$Revision: 57207 $</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*/</span><br />
<span style="color:#7f0055;"><strong>public interface </strong></span><span style="color:#000000;">LobTester</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#7f0055;"><strong>create</strong></span><span style="color:#000000;">()</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">HashMap findBlob</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">String findClob</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">create2</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">BlobEntity2 findBlob2</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception;</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: LobTesterBean.java</span></p>
<p><span style="color:#3f7f5f;">/*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* JBoss, Home of Professional Open Source.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Copyright 2006, Red Hat Middleware LLC, and individual contributors</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* as indicated by the @author tags. See the copyright.txt file in the</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* distribution for a full listing of individual contributors.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This is free software; you can redistribute it and/or modify it</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* under the terms of the GNU Lesser General Public License as</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* published by the Free Software Foundation; either version 2.1 of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* the License, or (at your option) any later version.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This software is distributed in the hope that it will be useful,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Lesser General Public License for more details.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* You should have received a copy of the GNU Lesser General Public</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* License along with this software; if not, write to the Free</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* 02110-1301 USA, or see the FSF site: http://www.fsf.org.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*/</span><br />
<span style="color:#7f0055;"><strong>package </strong></span><span style="color:#000000;">org.jboss.tutorial.blob.bean;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.io.ByteArrayOutputStream;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.io.IOException;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.io.ObjectInputStream;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.io.ObjectOutputStream;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.HashMap;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Remote;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Stateless;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.EntityManager;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.PersistenceContext;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.PersistenceContext;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">org.hibernate.Hibernate;</span></p>
<p><span style="color:#3f5fbf;">/**</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* Comment</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@author </span><span style="color:#3f5fbf;">&lt;a href=&#8221;mailto:bill@jboss.org&#8221;&gt;Bill Burke&lt;/a&gt;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@version </span><span style="color:#3f5fbf;">$Revision: 57207 $</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*/</span><br />
<span style="color:#000000;">@Stateless</span><br />
<span style="color:#000000;">@Remote</span><span style="color:#000000;">(</span><span style="color:#000000;">LobTester.</span><span style="color:#7f0055;"><strong>class</strong></span><span style="color:#000000;">)</span><br />
<span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">LobTesterBean </span><span style="color:#7f0055;"><strong>implements </strong></span><span style="color:#000000;">LobTester</span><br />
<span style="color:#000000;">{</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@PersistenceContext EntityManager manager;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#7f0055;"><strong>create</strong></span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">BlobEntity blob = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">BlobEntity</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">HashMap map = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">HashMap</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">map.put</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;hello&#8221;</span><span style="color:#000000;">, </span><span style="color:#2a00ff;">&#8220;world&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">ByteArrayOutputStream baos = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">ByteArrayOutputStream</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>try</strong></span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">ObjectOutputStream oos = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">ObjectOutputStream</span><span style="color:#000000;">(</span><span style="color:#000000;">baos</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">oos.writeObject</span><span style="color:#000000;">(</span><span style="color:#000000;">map</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">blob.setBlobby</span><span style="color:#000000;">(</span><span style="color:#000000;">Hibernate.createBlob</span><span style="color:#000000;">(</span><span style="color:#000000;">baos.toByteArray</span><span style="color:#000000;">()))</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>catch </strong></span><span style="color:#000000;">(</span><span style="color:#000000;">IOException e</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>throw new </strong></span><span style="color:#000000;">RuntimeException</span><span style="color:#000000;">(</span><span style="color:#000000;">e</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">String clobby = </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221;</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">blob.setClobby</span><span style="color:#000000;">(</span><span style="color:#000000;">Hibernate.createClob</span><span style="color:#000000;">(</span><span style="color:#000000;">clobby</span><span style="color:#000000;">))</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">manager.persist</span><span style="color:#000000;">(</span><span style="color:#000000;">blob</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">blob.getId</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">HashMap findBlob</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">BlobEntity blob = manager.find</span><span style="color:#000000;">(</span><span style="color:#000000;">BlobEntity.class, id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">ObjectInputStream ois = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">ObjectInputStream</span><span style="color:#000000;">(</span><span style="color:#000000;">blob.getBlobby</span><span style="color:#000000;">()</span><span style="color:#000000;">.getBinaryStream</span><span style="color:#000000;">())</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">(</span><span style="color:#000000;">HashMap</span><span style="color:#000000;">) </span><span style="color:#000000;">ois.readObject</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">String findClob</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">BlobEntity blob = manager.find</span><span style="color:#000000;">(</span><span style="color:#000000;">BlobEntity.class, id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">blob.getClobby</span><span style="color:#000000;">()</span><span style="color:#000000;">.getSubString</span><span style="color:#000000;">(</span><span style="color:#990000;">1</span><span style="color:#000000;">, </span><span style="color:#990000;">31</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">create2</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">BlobEntity2 blob = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">BlobEntity2</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">HashMap map = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">HashMap</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">map.put</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;hello&#8221;</span><span style="color:#000000;">, </span><span style="color:#2a00ff;">&#8220;world&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">ByteArrayOutputStream baos = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">ByteArrayOutputStream</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>try</strong></span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">ObjectOutputStream oos = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">ObjectOutputStream</span><span style="color:#000000;">(</span><span style="color:#000000;">baos</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">oos.writeObject</span><span style="color:#000000;">(</span><span style="color:#000000;">map</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">blob.setBlobby</span><span style="color:#000000;">(</span><span style="color:#000000;">baos.toByteArray</span><span style="color:#000000;">())</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>catch </strong></span><span style="color:#000000;">(</span><span style="color:#000000;">IOException e</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>throw new </strong></span><span style="color:#000000;">RuntimeException</span><span style="color:#000000;">(</span><span style="color:#000000;">e</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">String clobby = </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221; </span><span style="color:#000000;">+</span><br />
<span style="color:#ffffff;"> </span><span style="color:#2a00ff;">&#8220;This is a very long string that will be stored in a java.sql.Clob hopefully.  We&#8217;ll see how this works and if it will work&#8221;</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">blob.setClobby</span><span style="color:#000000;">(</span><span style="color:#000000;">clobby</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">manager.persist</span><span style="color:#000000;">(</span><span style="color:#000000;">blob</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">blob.getId</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">BlobEntity2 findBlob2</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">manager.find</span><span style="color:#000000;">(</span><span style="color:#000000;">BlobEntity2.class, id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: BlobEntity2.java</span></p>
<p><span style="color:#3f7f5f;">/*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* JBoss, Home of Professional Open Source.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Copyright 2006, Red Hat Middleware LLC, and individual contributors</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* as indicated by the @author tags. See the copyright.txt file in the</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* distribution for a full listing of individual contributors.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This is free software; you can redistribute it and/or modify it</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* under the terms of the GNU Lesser General Public License as</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* published by the Free Software Foundation; either version 2.1 of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* the License, or (at your option) any later version.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This software is distributed in the hope that it will be useful,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Lesser General Public License for more details.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* You should have received a copy of the GNU Lesser General Public</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* License along with this software; if not, write to the Free</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* 02110-1301 USA, or see the FSF site: http://www.fsf.org.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*/</span><br />
<span style="color:#7f0055;"><strong>package </strong></span><span style="color:#000000;">org.jboss.tutorial.blob.bean;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.io.Serializable;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Basic;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Entity;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.FetchType;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.GeneratedValue;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.GenerationType;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Id;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Lob;</span></p>
<p><span style="color:#3f5fbf;">/**</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* comment</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@author </span><span style="color:#3f5fbf;">&lt;a href=&#8221;mailto:bill@jboss.org&#8221;&gt;Bill Burke&lt;/a&gt;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*/</span><br />
<span style="color:#000000;">@Entity</span><br />
<span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">BlobEntity2 </span><span style="color:#7f0055;"><strong>implements </strong></span><span style="color:#000000;">Serializable</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#7f0055;"><strong>byte</strong></span><span style="color:#000000;">[] </span><span style="color:#000000;">blobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">String clobby;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Id @GeneratedValue</span><span style="color:#000000;">(</span><span style="color:#000000;">strategy=GenerationType.AUTO</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">getId</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setId</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.id = id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Lob @Basic</span><span style="color:#000000;">(</span><span style="color:#000000;">fetch = FetchType.EAGER</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>byte</strong></span><span style="color:#000000;">[] </span><span style="color:#000000;">getBlobby</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">blobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setBlobby</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>byte</strong></span><span style="color:#000000;">[] </span><span style="color:#000000;">blobby</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.blobby = blobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Lob @Basic</span><span style="color:#000000;">(</span><span style="color:#000000;">fetch = FetchType.EAGER</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">String getClobby</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">clobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setClobby</span><span style="color:#000000;">(</span><span style="color:#000000;">String clobby</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.clobby = clobby;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: Client.java</span></p>
<p><span style="color:#3f7f5f;">/*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* JBoss, Home of Professional Open Source.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Copyright 2006, Red Hat Middleware LLC, and individual contributors</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* as indicated by the @author tags. See the copyright.txt file in the</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* distribution for a full listing of individual contributors.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This is free software; you can redistribute it and/or modify it</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* under the terms of the GNU Lesser General Public License as</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* published by the Free Software Foundation; either version 2.1 of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* the License, or (at your option) any later version.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* This software is distributed in the hope that it will be useful,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Lesser General Public License for more details.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* You should have received a copy of the GNU Lesser General Public</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* License along with this software; if not, write to the Free</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">* 02110-1301 USA, or see the FSF site: http://www.fsf.org.</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">*/</span><br />
<span style="color:#7f0055;"><strong>package </strong></span><span style="color:#000000;">org.jboss.tutorial.blob.client;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.HashMap;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.naming.InitialContext;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">org.jboss.tutorial.blob.bean.LobTester;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">org.jboss.tutorial.blob.bean.BlobEntity2;</span></p>
<p><span style="color:#3f5fbf;">/**</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* Comment</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@author </span><span style="color:#3f5fbf;">&lt;a href=&#8221;mailto:bill@jboss.org&#8221;&gt;Bill Burke&lt;/a&gt;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">* </span><span style="color:#7f9fbf;">@version </span><span style="color:#3f5fbf;">$Revision: 57207 $</span><br />
<span style="color:#ffffff;"> </span><span style="color:#3f5fbf;">*/</span><br />
<span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">Client</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public static </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">main</span><span style="color:#000000;">(</span><span style="color:#000000;">String</span><span style="color:#000000;">[] </span><span style="color:#000000;">args</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">InitialContext ctx = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">InitialContext</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">LobTester test = </span><span style="color:#000000;">(</span><span style="color:#000000;">LobTester</span><span style="color:#000000;">) </span><span style="color:#000000;">ctx.lookup</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;LobTesterBean/remote&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">blobId = test.</span><span style="color:#7f0055;"><strong>create</strong></span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">HashMap map = test.findBlob</span><span style="color:#000000;">(</span><span style="color:#000000;">blobId</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;is hello in map: &#8221; </span><span style="color:#000000;">+ map.get</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;hello&#8221;</span><span style="color:#000000;">))</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#000000;">test.findClob</span><span style="color:#000000;">(</span><span style="color:#000000;">blobId</span><span style="color:#000000;">))</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;creating and getting a BlobEntity2 that uses byte[] and String instead of Clob/Blob&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">blobId = test.create2</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">BlobEntity2 entity = test.findBlob2</span><span style="color:#000000;">(</span><span style="color:#000000;">blobId</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">}</span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/240/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=240&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2009/08/05/ejb-tutorial-from-jboss-entity-with-blob-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
		<item>
		<title>Working with Binary Data using EJB</title>
		<link>http://middlewares.wordpress.com/2009/08/05/working-with-binary-data-using-ejb/</link>
		<comments>http://middlewares.wordpress.com/2009/08/05/working-with-binary-data-using-ejb/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 03:28:46 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[Programs]]></category>
		<category><![CDATA[EJB]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/?p=238</guid>
		<description><![CDATA[// Working with Binary Data in EJB File: CustomerType.java public enum CustomerType { UNREGISTERED, REGISTERED, BIG_SPENDAH } File: Employee.java import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity //@Table(name=&#8221;EMP&#8221;, schema=&#8221;HR&#8221;) @Table(name=&#8220;EMP&#8221;) public class Employee implements Serializable { @Id @Column(name = &#8220;EMP_ID&#8221;) private int [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=238&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="text-align:center;">// Working with Binary Data in EJB</h2>
<p><span style="font-family:0;font-size:13px;white-space:nowrap;"><span style="color:#000000;">File: CustomerType.java</span></p>
<p><span style="color:#7f0055;"><strong>public enum </strong></span><span style="color:#000000;">CustomerType</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">UNREGISTERED,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">REGISTERED,</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">BIG_SPENDAH</span><br />
<span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span></p>
<p><span style="color:#000000;">File: Employee.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.io.Serializable;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.Date;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Basic;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Column;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Entity;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.EnumType;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Enumerated;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.FetchType;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Id;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Lob;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Table;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Temporal;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.TemporalType;</span></p>
<p><span style="color:#000000;">@Entity</span><br />
<span style="color:#3f7f5f;">//@Table(name=&#8221;EMP&#8221;, schema=&#8221;HR&#8221;)</span><br />
<span style="color:#000000;">@Table</span><span style="color:#000000;">(</span><span style="color:#000000;">name=</span><span style="color:#2a00ff;">&#8220;EMP&#8221;</span><span style="color:#000000;">)</span><br />
<span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">Employee </span><span style="color:#7f0055;"><strong>implements </strong></span><span style="color:#000000;">Serializable </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">@Id</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">@Column</span><span style="color:#000000;">(</span><span style="color:#000000;">name = </span><span style="color:#2a00ff;">&#8220;EMP_ID&#8221;</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">@Column</span><span style="color:#000000;">(</span><span style="color:#000000;">name = </span><span style="color:#2a00ff;">&#8220;COMM&#8221;</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">String name;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">@Column</span><span style="color:#000000;">(</span><span style="color:#000000;">name = </span><span style="color:#2a00ff;">&#8220;SAL&#8221;</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">salary;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">CustomerType customerType;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">Date timeCreated = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">Date</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>private </strong></span><span style="color:#000000;">MyImage picture;</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.id = id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">getId</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setId</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.id = id;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">String getName</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">name;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setName</span><span style="color:#000000;">(</span><span style="color:#000000;">String name</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.name = name;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">getSalary</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">salary;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setSalary</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">salary</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>this</strong></span><span style="color:#000000;">.salary = salary;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Enumerated</span><span style="color:#000000;">(</span><span style="color:#000000;">EnumType.STRING</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">CustomerType getCustomerType</span><span style="color:#000000;">() { </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">customerType; </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setCustomerType</span><span style="color:#000000;">(</span><span style="color:#000000;">CustomerType type</span><span style="color:#000000;">) { </span><span style="color:#000000;">customerType = type; </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Temporal</span><span style="color:#000000;">(</span><span style="color:#000000;">TemporalType.TIME</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Date getTimeCreated</span><span style="color:#000000;">() { </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">timeCreated; </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setTimeCreated</span><span style="color:#000000;">(</span><span style="color:#000000;">Date time</span><span style="color:#000000;">) { </span><span style="color:#000000;">timeCreated = time; </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Lob @Basic</span><span style="color:#000000;">(</span><span style="color:#000000;">fetch=FetchType.LAZY</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">MyImage getPicture</span><span style="color:#000000;">() { </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">picture; </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">setPicture</span><span style="color:#000000;">(</span><span style="color:#000000;">MyImage jpeg</span><span style="color:#000000;">) { </span><span style="color:#000000;">picture = jpeg; </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">String toString</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#2a00ff;">&#8220;Employee id: &#8221; </span><span style="color:#000000;">+ getId</span><span style="color:#000000;">() </span><span style="color:#000000;">+ </span><span style="color:#2a00ff;">&#8220; name: &#8221; </span><span style="color:#000000;">+ getName</span><span style="color:#000000;">() </span><span style="color:#000000;">+ </span><span style="color:#2a00ff;">&#8220; salary: &#8221; </span><span style="color:#000000;">+ getSalary</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: EmployeeService.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.Collection;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Remove;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Stateless;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.EntityManager;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.PersistenceContext;</span><br />
<span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.persistence.Query;</span></p>
<p><span style="color:#000000;">@Stateless</span><br />
<span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">EmployeeService </span><span style="color:#7f0055;"><strong>implements </strong></span><span style="color:#000000;">EmployeeServiceLocal, EmployeeServiceRemote </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">@PersistenceContext</span><span style="color:#000000;">(</span><span style="color:#000000;">unitName=</span><span style="color:#2a00ff;">&#8220;EmployeeService&#8221;</span><span style="color:#000000;">)</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">EntityManager em;</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">EmployeeService</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee createEmployee</span><span style="color:#000000;">(</span><span style="color:#000000;">Employee emp</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">em.persist</span><span style="color:#000000;">(</span><span style="color:#000000;">emp</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">em.flush</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">emp;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee createEmployee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id, String name, </span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">salary</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">Employee emp = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">Employee</span><span style="color:#000000;">(</span><span style="color:#000000;">id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">emp.setName</span><span style="color:#000000;">(</span><span style="color:#000000;">name</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">emp.setSalary</span><span style="color:#000000;">(</span><span style="color:#000000;">salary</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">em.persist</span><span style="color:#000000;">(</span><span style="color:#000000;">emp</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">em.flush</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">emp;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">removeEmployee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">Employee emp = findEmployee</span><span style="color:#000000;">(</span><span style="color:#000000;">id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>if </strong></span><span style="color:#000000;">(</span><span style="color:#000000;">emp != </span><span style="color:#7f0055;"><strong>null</strong></span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">em.remove</span><span style="color:#000000;">(</span><span style="color:#000000;">emp</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee raiseEmployeeSalary</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id, </span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">raise</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">Employee emp = em.find</span><span style="color:#000000;">(</span><span style="color:#000000;">Employee.class, id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>if </strong></span><span style="color:#000000;">(</span><span style="color:#000000;">emp != </span><span style="color:#7f0055;"><strong>null</strong></span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">emp.setSalary</span><span style="color:#000000;">(</span><span style="color:#000000;">emp.getSalary</span><span style="color:#000000;">() </span><span style="color:#000000;">+ raise</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">emp;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee findEmployee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">) {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">em.find</span><span style="color:#000000;">(</span><span style="color:#000000;">Employee.class, id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Collection&lt;Employee&gt; findAllEmployees</span><span style="color:#000000;">() {</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">Query query = em.createQuery</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;SELECT e FROM Employee e&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>return </strong></span><span style="color:#000000;">(</span><span style="color:#000000;">Collection&lt;Employee&gt;</span><span style="color:#000000;">) </span><span style="color:#000000;">query.getResultList</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">doAction</span><span style="color:#000000;">(){</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">@Remove</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">remove</span><span style="color:#000000;">()</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;removed&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#ffffff;"> </span></p>
<p><span style="color:#000000;">File: EmployeeServiceLocal.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.Collection;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Local;</span></p>
<p><span style="color:#000000;">@Local</span><br />
<span style="color:#7f0055;"><strong>public interface </strong></span><span style="color:#000000;">EmployeeServiceLocal </span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">doAction</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee createEmployee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id, String name, </span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">salary</span><span style="color:#000000;">) </span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee createEmployee</span><span style="color:#000000;">(</span><span style="color:#000000;">Employee emp</span><span style="color:#000000;">) </span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">removeEmployee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee raiseEmployeeSalary</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id, </span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">raise</span><span style="color:#000000;">) </span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee findEmployee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Collection&lt;Employee&gt; findAllEmployees</span><span style="color:#000000;">() </span><span style="color:#000000;">;</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: EmployeeServiceRemote.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.Collection;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.ejb.Remote;</span></p>
<p><span style="color:#000000;">@Remote</span><br />
<span style="color:#7f0055;"><strong>public interface </strong></span><span style="color:#000000;">EmployeeServiceRemote</span><span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">doAction</span><span style="color:#000000;">()</span><span style="color:#000000;">; </span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee createEmployee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id, String name, </span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">salary</span><span style="color:#000000;">) </span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee createEmployee</span><span style="color:#000000;">(</span><span style="color:#000000;">Employee emp</span><span style="color:#000000;">) </span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">removeEmployee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee raiseEmployeeSalary</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id, </span><span style="color:#7f0055;"><strong>long </strong></span><span style="color:#000000;">raise</span><span style="color:#000000;">) </span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Employee findEmployee</span><span style="color:#000000;">(</span><span style="color:#7f0055;"><strong>int </strong></span><span style="color:#000000;">id</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">Collection&lt;Employee&gt; findAllEmployees</span><span style="color:#000000;">() </span><span style="color:#000000;">; </span></p>
<p><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: MyImage.java</span></p>
<p><span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">MyImage </span><span style="color:#7f0055;"><strong>implements </strong></span><span style="color:#000000;">java.io.Serializable</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public </strong></span><span style="color:#000000;">MyImage</span><span style="color:#000000;">() {}</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: Main.java</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">java.util.Collection;</span></p>
<p><span style="color:#7f0055;"><strong>import </strong></span><span style="color:#000000;">javax.naming.InitialContext;</span></p>
<p><span style="color:#7f0055;"><strong>public class </strong></span><span style="color:#000000;">Main </span><span style="color:#000000;">{</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#7f0055;"><strong>public static </strong></span><span style="color:#7f0055;"><strong>void </strong></span><span style="color:#000000;">main</span><span style="color:#000000;">(</span><span style="color:#000000;">String</span><span style="color:#000000;">[] </span><span style="color:#000000;">a</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>throws </strong></span><span style="color:#000000;">Exception </span><span style="color:#000000;">{</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#000000;">EmployeeServiceRemote service = </span><span style="color:#7f0055;"><strong>null</strong></span><span style="color:#000000;">;</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">// Context compEnv = (Context) new InitialContext().lookup(&#8220;java:comp/env&#8221;);</span></p>
<p><span style="color:#ffffff;"> </span><span style="color:#3f7f5f;">// service = (HelloService)new InitialContext().lookup(&#8220;java:comp/env/ejb/HelloService&#8221;);</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">service = </span><span style="color:#000000;">(</span><span style="color:#000000;">EmployeeServiceRemote</span><span style="color:#000000;">) </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">InitialContext</span><span style="color:#000000;">()</span><span style="color:#000000;">.lookup</span><span style="color:#000000;">(</span><span style="color:#2a00ff;">&#8220;EmployeeService/remote&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">service.createEmployee</span><span style="color:#000000;">(</span><span style="color:#990000;">158</span><span style="color:#000000;">, </span><span style="color:#2a00ff;">&#8220;AAA&#8221;</span><span style="color:#000000;">, </span><span style="color:#990000;">45000</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">service.createEmployee</span><span style="color:#000000;">(</span><span style="color:#990000;">159</span><span style="color:#000000;">, </span><span style="color:#2a00ff;">&#8220;AAA&#8221;</span><span style="color:#000000;">, </span><span style="color:#990000;">45000</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">Employee emp = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">Employee</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">emp.setId</span><span style="color:#000000;">(</span><span style="color:#990000;">160</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">emp.setCustomerType</span><span style="color:#000000;">(</span><span style="color:#000000;">CustomerType.BIG_SPENDAH</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">MyImage oneUglyDude = </span><span style="color:#7f0055;"><strong>new </strong></span><span style="color:#000000;">MyImage</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">emp.setPicture</span><span style="color:#000000;">(</span><span style="color:#000000;">oneUglyDude</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">service.createEmployee</span><span style="color:#000000;">(</span><span style="color:#000000;">emp</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">Employee emp1 = service.findEmployee</span><span style="color:#000000;">(</span><span style="color:#990000;">160</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#000000;">emp1</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">Collection&lt;Employee&gt; list = service.findAllEmployees</span><span style="color:#000000;">()</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">System.out.println</span><span style="color:#000000;">(</span><span style="color:#000000;">list</span><span style="color:#000000;">)</span><span style="color:#000000;">;</span><br />
<span style="color:#ffffff;"> </span><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">File: jndi.properties</span></p>
<p><span style="color:#000000;">java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory</span><br />
<span style="color:#000000;">java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces</span><br />
<span style="color:#000000;">java.naming.provider.url=localhost:</span><span style="color:#990000;">1099</span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/238/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=238&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2009/08/05/working-with-binary-data-using-ejb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
		<item>
		<title>What is Moniker?</title>
		<link>http://middlewares.wordpress.com/2008/05/12/what-is-moniker/</link>
		<comments>http://middlewares.wordpress.com/2008/05/12/what-is-moniker/#comments</comments>
		<pubDate>Mon, 12 May 2008 17:07:08 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[COM]]></category>
		<category><![CDATA[Technical Questions]]></category>
		<category><![CDATA[Two Marks]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/?p=236</guid>
		<description><![CDATA[A moniker is an object (or component ) in Microsoft&#8217;s Component Object Model ( COM ) that refers to a specific instance of another object. Monikers originated in Microsoft&#8217;s Object Linking and Embedding ( OLE ) technology as a means of linking objects. A moniker may refer to any single object, or may be a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=236&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><span style="color:#800000;"><strong>A moniker is an <a href="http://searchsoa.techtarget.com/sDefinition/0,,sid26_gci212680,00.html">object</a> (or <a href="http://whatis.techtarget.com/definition/0,289893,sid9_gci211826,00.html">component</a> ) in Microsoft&#8217;s Component Object Model ( <a href="http://searchsoa.techtarget.com/sDefinition/0,,sid26_gci211817,00.html">COM</a> ) that refers to a specific <a href="http://searchsoa.techtarget.com/sDefinition/0,,sid26_gci1123542,00.html">instance</a> of another object. </strong></span>Monikers originated in Microsoft&#8217;s Object Linking and Embedding ( <a href="http://searchwinit.techtarget.com/sDefinition/0,,sid1_gci214126,00.html">OLE</a> ) technology as a means of linking objects.</p>
<p style="text-align:justify;">A moniker may refer to any single object, or may be a composite made of a number of separate monikers, each of which refers to a particular instantiation of an object.</p>
<p style="text-align:justify;">The moniker is sometimes referred to as an &#8220;intelligent name,&#8221; because it retains information about how to create, <a href="http://searchwinit.techtarget.com/sDefinition/0,,sid1_gci214126,00.html">initialize</a> , and <a href="http://whatis.techtarget.com/definition/0,289893,sid9_gci211662,00.html">bind</a> to a single instance of an object. Once created, the moniker holds this information, as well as information about the object&#8217;s states in that specific instantiation.</p>
<p style="text-align:justify;">Since COM is not language-specific, a moniker can be used with any programming language. The programmer gives the instantiation of the object a name. By calling the moniker in code, a programmer can refer to the same object with the same states.</p>
<p style="text-align:justify;">If, for example, a moniker is created for a <a href="http://searchsqlserver.techtarget.com/sDefinition/0,,sid87_gci214553,00.html">query</a> , the programmer can reuse the query simply by calling the moniker in the code, because the moniker itself has the necessary information.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/middlewares.wordpress.com/236/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/middlewares.wordpress.com/236/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/236/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=236&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2008/05/12/what-is-moniker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
		<item>
		<title>EJB – Two Marks Q &amp; A</title>
		<link>http://middlewares.wordpress.com/2008/05/02/ejb-%e2%80%93-two-marks-q-a/</link>
		<comments>http://middlewares.wordpress.com/2008/05/02/ejb-%e2%80%93-two-marks-q-a/#comments</comments>
		<pubDate>Fri, 02 May 2008 04:12:48 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[EJB]]></category>
		<category><![CDATA[Technical Questions]]></category>
		<category><![CDATA[Two Marks]]></category>
		<category><![CDATA[Q&A]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/?p=235</guid>
		<description><![CDATA[What is EJB? EJB stands for Enterprise Java Bean and is widely-adopted server side component architecture for J2EE. It enables rapid development of mission-critical application that are versatile, reusable and portable across middleware while protecting IT investment and preventing vendor lock-in. What is the difference between EJB and Java beans? EJB is a specification for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=235&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">What is EJB? </span></strong></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">EJB stands for Enterprise Java Bean and is widely-adopted server side component architecture for J2EE. It enables rapid development of mission-critical application that are versatile, reusable and portable across middleware while protecting IT investment and preventing vendor lock-in.</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue0"><strong><span style="color:black;">What is the difference between EJB and Java beans?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">EJB is a specification for J2EE server, not a product; Java beans may be a graphical component in IDE.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">What is EJB role in J2EE? </span></strong></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">EJB technology is the core of J2EE. It enables developers to write reusable and portable server-side business logic for the J2EE platform.</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">What are the key features of the EJB technology? </span></strong></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>1.<span> </span></span></span><!--[endif]--><span style="color:black;">EJB components are server-side components written entirely in the Java programming language </span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>2.<span> </span></span></span><!--[endif]--><span style="color:black;">EJB components contain business logic only &#8211; no system-level programming &amp; services, such as transactions, security, life-cycle, threading, persistence, etc. are automatically managed for the EJB component by the EJB server. </span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>3.<span> </span></span></span><!--[endif]--><span style="color:black;">EJB architecture is inherently transactional, distributed, portable multi-tier, scalable and secure.</span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>4.<span> </span></span></span><!--[endif]--><span style="color:black;">EJB components are fully portable across any EJB server and any OS.</span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>5.<span> </span></span></span><!--[endif]--><span style="color:black;">EJB architecture is wire-protocol neutral&#8211;any protocol can be utilized like IIOP,JRMP, HTTP, DCOM,etc.</span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">What are the key benefits of the EJB technology? </span></strong></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>1.<span> </span></span></span><!--[endif]--><span style="color:black;">Rapid application development </span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>2.<span> </span></span></span><!--[endif]--><span style="color:black;">Broad industry adoption </span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>3.<span> </span></span></span><!--[endif]--><span style="color:black;">Application portability </span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>4.<span> </span></span></span><!--[endif]--><span style="color:black;">Protection of IT investment</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">How many enterprise beans? </span></strong></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">There are three kinds of enterprise beans: </span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.75in;"><!--[if !supportLists]--><span style="color:black;"><span>1.<span> </span></span></span><!--[endif]--><span style="color:black;">session beans, </span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.75in;"><!--[if !supportLists]--><span style="color:black;"><span>2.<span> </span></span></span><!--[endif]--><span style="color:black;">entity beans, and </span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.75in;"><!--[if !supportLists]--><span style="color:black;"><span>3.<span> </span></span></span><!--[endif]--><span style="color:black;">Message-driven beans.</span></p>
<p style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.75in;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">What is message-driven bean? </span></strong></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">A message-driven bean combines features of a session bean and a Java Message Service (JMS) message listener, allowing a business component to receive JMS. A message-driven bean enables asynchronous clients to access the business logic in the EJB tier.</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">What are Entity Bean and Session Bean? </span></strong></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">Entity Bean is a Java class which implements an Enterprise Bean interface and provides the implementation of the business methods. There are two types: Container Managed Persistence (CMP) and Bean-Managed Persistence (BMP).</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">Session Bean is used to represent a workflow on behalf of a client. There are two types: <strong><em>Stateless and Stateful</em></strong>. Stateless bean is the simplest bean. It doesn&#8217;t maintain any conversational state with clients between method invocations. Stateful bean maintains state between invocations.</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is Session Bean? Explain</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">A session bean is a non-persistent object that implements some business logic running on the server. One way to think of a session object is as a logical extension of the client program that runs on the server.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"><br />
Session beans are used to manage the interactions of entity and other session beans,access resources, and generally perform tasks on behalf of the client.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"><br />
There are two basic kinds of session bean: stateless and stateful.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"><br />
Stateless session beans are made up of business methods that behave like procedures; they operate only on the arguments passed to them when they are invoked. Stateless beans are called stateless because they are transient; they do not maintain business state between method invocations. Each invocation of a stateless business method is independent from previous invocations. Because stateless session beans are stateless, they are easier for the EJB container to manage, so they tend to process requests faster and use fewer resources.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"><br />
Stateful session beans encapsulate business logic and state specific to a client. Stateful beans are called “stateful” because they do maintain business state between method invocations, held in memory and not persistent. Unlike stateless session beans, clients do not share stateful beans. When a client creates a stateful bean, that bean instance is dedicated to service only that client. This makes it possible to maintain conversational state, which is business state that can be shared by methods in the same stateful bean.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is the difference between session and entity beans?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">An entity bean represents persistent global data from the database; a session bean represents transient user-specific data that will die when the user disconnects (ends his session). Generally, the session beans implement business methods (e.g. Bank.transferFunds) that call entity beans (e.g. Account.deposit, Account.withdraw)</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What are the services provided by container?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">Container services are totally depends upon the “vendor implementation”. But more or less most of the vendors suppots the basic services like, </span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>1.<span> </span></span></span><!--[endif]--><span style="color:black;">LifeCycle Management &#8211; It is Automatic.</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>2.<span> </span></span></span><!--[endif]--><span style="color:black;">Session Management &#8211; it is used by Developer coded callback methods…</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>3.<span> </span></span></span><!--[endif]--><span style="color:black;">Transaction Management &#8211; it is used by configuring deployment descriptor (DD).</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>4.<span> </span></span></span><!--[endif]--><span style="color:black;">Security management &#8211; it is used by configuring deployment descriptor (DD).</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">The other services, if any will be in advanced versions, and depends on Vendor specific.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is Deployment descriptor?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">A deployment descriptor is an XML file packaged with the enterprise beans in an EJB JAR file or an EAR file. It contains metadata describing the contents and structure of the enterprise beans, and runtime transaction and security information for the EJB container.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">How many EJB Objects are created for a Bean?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">For a Session bean &#8211; one EJB object for one bean instance.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">For entity bean &#8211; it depends , if two users are accessing one row at time then one EJB object is used for both the beans other wise for each bean one EJB object.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is re-entrant. Is session beans reentrant. Is entity beans reentrant?</span></strong></span><strong><span style="color:black;"><br />
</span></strong><span style="color:black;">If we define the entity bean as being reentrant, multiple clients can connect to the Entity bean &amp; execute methods within the entity bean concurrently. Container takes care of synchronization. If we define the entity bean as non-reentrant and many clients connect to it concurrently to execute a method, exception is thrown</span></p>
<p class="MsoNormal" style="text-align:justify;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is EJB container?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">An EJB container is a run-time environment that manages one or more enterprise beans. The EJB container manages the life cycles of enterprise bean objects, coordinates distributed transactions, and implements object security. Generally, each EJB container is provided by an EJB server and contains a set of enterprise beans that run on the server.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is EJB server?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">An EJB server is a high-level process or application that provides a run-time environment to support the execution of server applications that use enterprise beans. An EJB server provides a JNDI-accessible naming service, manages and coordinates the allocation of resources to client applications, provides access to system resources, and provides a transaction service. An EJB server could be provided by, for example, a database or application server.</span></p>
<p class="MsoNormal" style="text-align:justify;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is the difference between ejbCreate() and ejbPostCreate?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">The purpose of ejbPostCreate() is to perform clean-up database operations after SQL INSERTs (which occur when ejbCreate() is called) when working with CMP entity beans. ejbCreate() is called before database INSERT operations. You need to use ejbPostCreate() to define operations, like set a flag, after INSERT completes successfully.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">Why does EJB needs two interfaces(Home and Remote Interface)</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">There is a pure division of roles between the two .<br />
Home Interface is the way to communicate with the container which is responsible for creating , locating and removing beans and Remote Interface is the link to the bean that allows acces to all methods and members.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">What is the difference between a Server, a Container, and a Connector? </span></strong></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">An EJB server is an application, usually a product such as BEA WebLogic, that provides (or should provide) for concurrent client connections and manages system resources such as threads, processes, memory, database connections, network connections, etc. An EJB container runs inside (or within) an EJB server, and provides deployed EJB beans with transaction and security management, etc. The EJB container insulates an EJB bean from the specifics of an underlying EJB server by providing a simple, standard API between the EJB bean and its container. A Connector provides the ability for any Enterprise Information System (EIS) to plug into any EJB server which supports the Connector architecture. See Sun’s J2EE Connectors for more in-depth information on Connectors.</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;"> </span></strong></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">Why is ejbFindByPrimaryKey mandatory? </span></strong></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">An Entity Bean represents persistent data that is stored outside of the EJB Container/Server. The ejbFindByPrimaryKey is a method used to locate and load an Entity Bean into the container, similar to a SELECT statement in SQL. By making this method mandatory, the client programmer can be assured that if they have the primary key of the Entity Bean, then they can retrieve the bean without having to create a new bean each time &#8211; which would mean creating duplications of persistent data and break the integrity of EJB.</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">What is the default transaction attribute for an EJB? </span></strong></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">There is no default transaction attribute for an EJB. Section 11.5 of EJB v1.1 spec says that the deployer must specify a value for the transaction attribute for those methods having container managed transaction. In WebLogic, the default transaction attribute for EJB is SUPPORTS.</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;"> </span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is software architecture of EJB?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">Session and Entity EJBs consist of 4 and 5 parts respetively:</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>1.<span> </span></span></span><!--[endif]--><span style="color:black;">A remote interface (a client interacts with it),</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>2.<span> </span></span></span><!--[endif]--><span style="color:black;">A home interface (used for creating objects and for declaring business methods),</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>3.<span> </span></span></span><!--[endif]--><span style="color:black;">A bean object (an object, which actually performs business logic and EJB-specific operations).</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>4.<span> </span></span></span><!--[endif]--><span style="color:black;">A deployment descriptor (an XML file containing all information required for maintaining the EJB) or a set of deployment descriptors (if you are using some container-specific features).</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>5.<span> </span></span></span><!--[endif]--><span style="color:black;">A Primary Key class &#8211; is only Entity bean specific.</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is an EJB Context?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext. These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. </span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/middlewares.wordpress.com/235/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/middlewares.wordpress.com/235/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/235/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=235&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2008/05/02/ejb-%e2%80%93-two-marks-q-a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
		<item>
		<title>EJB &#8211; Interview Questions &amp; Answers</title>
		<link>http://middlewares.wordpress.com/2008/05/02/ejb-interview-questions-answers/</link>
		<comments>http://middlewares.wordpress.com/2008/05/02/ejb-interview-questions-answers/#comments</comments>
		<pubDate>Fri, 02 May 2008 04:09:18 +0000</pubDate>
		<dc:creator>இராய் அந்தோனி அர்னால்டு</dc:creator>
				<category><![CDATA[EJB]]></category>
		<category><![CDATA[Technical Questions]]></category>
		<category><![CDATA[Q&A]]></category>

		<guid isPermaLink="false">http://middlewares.wordpress.com/?p=234</guid>
		<description><![CDATA[What is session Facade? Session Facade is a design pattern to access the Entity bean through local interface than accessing directly. It increases the performance over the network. In this case we call session bean which on turn call entity bean. What technologies are included in J2EE? The main technologies in J2EE are: Enterprise JavaBeansTM [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=234&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;">
<p style="text-align:justify;margin:0 0 0.0001pt;"><strong><span style="color:black;">What is session Facade? </span></strong><span style="color:black;"></span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">Session Facade is a design pattern to access the Entity bean through local interface than accessing directly. It increases the performance over the network. In this case we call session bean which on turn call entity bean.</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;">
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What technologies are included in J2EE?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">The main technologies in J2EE are: Enterprise JavaBeansTM (EJBsTM), JavaServer PagesTM (JSPsTM), Java Servlets, the Java Naming and Directory InterfaceTM (JNDITM), the Java Transaction API (JTA), CORBA, and the JDBCTM data access API.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is EJB role in J2EE?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">EJB technology is the core of J2EE. It enables developers to write reusable and portable server-side business logic for the J2EE platform.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is </span></strong></span><span class="forquestionsblue"><strong><span style="color:black;">Enterprise</span></strong></span><span class="forquestionsblue"><strong><span style="color:black;"> JavaBeans (EJB) container?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">It manages the execution of enterprise beans for J2EE applications.<br />
</span><span style="color:black;">Enterprise</span><span style="color:black;"> beans and their container run on the J2EE server.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is the new basic requirement for a CMP entity bean class in 2.0 from that of ejb 1.1?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">It must be abstract class. The container extends it and implements methods which are required for managing the relationships</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What’s new in the EJB 2.0 specification?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">Following are some of the main features supported in EJB 2.0:</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><strong><span style="color:black;"><span>1.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span></strong><!--[endif]--><strong><span style="color:black;">Integration of EJB with JMS,</span></strong></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>2.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Message Driven Beans,</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>3.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Implement additional Business methods in Home interface which are not specific for bean instance, EJB QL.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">How can I access EJB from ASP?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">We can use the Java 2 Platform, Enterprise Edition Client Access Services (J2EETM CAS) </span><span style="color:black;">COM</span><span style="color:black;"> </span><span style="color:black;">Bridge</span><span style="color:black;"> 1.0, currently downloadable from Sun</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">How EJB Invocation happens?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">Step 1: Retrieve Home Object reference from Naming Service via JNDI.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">step 2: Return Home Object reference to the client.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">step 3: Create me a new EJB Object through Home Object interface.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">step 4: Create EJB Object from the Ejb Object</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">step 5: Return EJB Object reference to the client.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">step 6: Invoke business method using EJB Object reference.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">step 7: Delegate request to Bean (Enterprise Bean).</span></p>
<p style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is the relationship between local interfaces and container-managed relationships?</span></strong></span><strong><span style="color:black;"><br />
</span></strong><span style="color:black;">Entity beans that have container-managed relationships with other entity beans, must be accessed in the same local scope as those related beans, and therefore typically provide a local client view. In order to be the target of a container-managed relationship, an entity bean with container-managed persistence must provide a local interface.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">Are enterprise beans allowed to use Thread.sleep()?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">Enterprise</span><span style="color:black;"> beans make use of the services provided by the EJB container, such as life-cycle management. To avoid conflicts with these services, enterprise beans are restricted from performing certain operations: Managing or synchronizing threads</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What are Local Interfaces? Describe.</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">EJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally, that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What are transaction isolation levels in EJB?</span></strong></span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>1.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Transaction_read_uncommitted- Allows a method to read uncommitted data from a DB(fast but not wise).</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>2.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Transaction_read_committed- Guarantees that the data you are getting has been committed.</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>3.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Transaction_repeatable_read &#8211; Guarantees that all reads of the database will be the same during the transaction (good for read and update operations).</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>4.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Transaction_serializable- All the transactions for resource are performed serial.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is the difference between Container-Managed Persistent (CMP) bean and Bean-Managed Persistent(BMP) ?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">Container-managed persistence beans are the simplest for the bean developer to create and the most difficult for the EJB server to support. This is because all the logic for synchronizing the bean’s state with the database is handled automatically by the container. This means that the bean developer doesn’t need to write any data access logic, while the EJB server is supposed to take care of all the persistence needs automatically. With CMP, the container manages the persistence of the entity bean. A CMP bean developer doesn’t need to worry about JDBC code and transactions, because the Container performs database calls and transaction management instead of the programmer. Vendor tools are used to map the entity fields to the database and absolutely no database access code is written in the bean class. All table mapping is specified in the deployment descriptor. Otherwise, a BMP bean developer takes the load of linking an application and a database on his shoulders.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"><br />
The bean-managed persistence (BMP) enterprise bean manages synchronizing its state with the database as directed by the container. The bean uses a database API to read and write its fields to the database, but the container tells it when to do each synchronization operation and manages the transactions for the bean automatically. Bean-managed persistence gives the bean developer the flexibility to perform persistence operations that are too complicated for the container or to use a data source that is not supported by the container.BMP beans are not 100% database-independent, because they may contain database-specific code, but CMP beans are unable to perform complicated DML (data manipulation language) statements. EJB 2.0 specification introduced some new ways of querying database (by using the EJB QL &#8211; query language).</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;"> </span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is bean managed transaction?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">If a developer doesn’t want a Container to manage transactions, it’s possible to implement all database operations manually by writing the appropriate JDBC code. This often leads to productivity increase, but it makes an Entity Bean incompatible with some databases and it enlarges the amount of code to be written. All transaction management is explicitly performed by a developer.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What are transaction attributes?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">The transaction attribute specifies how the Container must manage transactions for a method when a client invokes the method via the enterprise bean’s home or component interface or when the method is invoked as the result of the arrival of a JMS message. (Sun’s EJB Specification) Below is a list of transactional attributes:</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>1.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">NotSupported &#8211; transaction context is unspecified.</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>2.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Required &#8211; bean’s method invocation is made within a transactional context. If a client is not associated with a transaction, a new transaction is invoked automatically.</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>3.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Supports &#8211; if a transactional context exists, a Container acts like the transaction attribute is Required, else &#8211; like NotSupported.</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>4.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">RequiresNew &#8211; a method is invoked in a new transaction context.</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>5.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Mandatory &#8211; if a transactional context exists, a Container acts like the transaction attribute is Required, else it throws a javax.ejb.TransactionRequiredException.</span></p>
<p class="answers" style="text-align:justify;text-indent:-0.25in;margin:0 0 0.0001pt 0.5in;"><!--[if !supportLists]--><span style="color:black;"><span>6.<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&quot;"> </span></span></span><!--[endif]--><span style="color:black;">Never &#8211; a method executes only if no transaction context is specified.</span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;"> </span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span class="forquestionsblue"><strong><span style="color:black;">What is the difference between Message Driven Beans and Stateless Session beans?</span></strong></span></p>
<p class="answers" style="text-align:justify;margin:0 0 0.0001pt;"><span style="color:black;">In several ways, the dynamic creation and allocation of message-driven bean instances mimics the behavior of stateless session EJB instances, which exist only for the duration of a particular method call. However, message-driven beans are different from stateless session EJBs (and other types of EJBs) in several significant ways: Message-driven beans process multiple JMS messages asynchronously, rather than processing a serialized sequence of method calls. Message-driven beans have no home or remote interface, and therefore cannot be directly accessed by internal or external clients. Clients interact with message-driven beans only indirectly, by sending a message to a JMS Queue or Topic. Only the container directly interacts with a message-driven bean by creating bean instances and passing JMS messages to those instances as necessary. The Container maintains the entire lifecycle of a message-driven bean; instances cannot be created or removed as a result of client requests or other API calls.</span></p>
<p class="MsoNormal" style="text-align:justify;"><span style="color:black;"><br />
</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/middlewares.wordpress.com/234/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/middlewares.wordpress.com/234/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewares.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewares.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/middlewares.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/middlewares.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/middlewares.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/middlewares.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/middlewares.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/middlewares.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/middlewares.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/middlewares.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/middlewares.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/middlewares.wordpress.com/234/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/middlewares.wordpress.com/234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/middlewares.wordpress.com/234/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewares.wordpress.com&amp;blog=2381034&amp;post=234&amp;subd=middlewares&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewares.wordpress.com/2008/05/02/ejb-interview-questions-answers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bfc8ca04ec731c01be8c56ac90e9ba34?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Arnold</media:title>
		</media:content>
	</item>
	</channel>
</rss>
