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

<channel>
	<title>@InitBinder &#187; stateless beans</title>
	<atom:link href="http://initbinder.com/categories/beans/stateless-beans/feed" rel="self" type="application/rss+xml" />
	<link>http://initbinder.com</link>
	<description>My thoughts, notes and ideas as a passionate software engineer</description>
	<lastBuildDate>Sat, 24 Mar 2012 13:29:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Stateless Beans and Annotations</title>
		<link>http://initbinder.com/articles/stateless_beans_and_annotations.html</link>
		<comments>http://initbinder.com/articles/stateless_beans_and_annotations.html#comments</comments>
		<pubDate>Sat, 10 May 2008 16:17:00 +0000</pubDate>
		<dc:creator>Alexander Zagniotov</dc:creator>
				<category><![CDATA[beans]]></category>
		<category><![CDATA[stateless beans]]></category>
		<category><![CDATA[annotations]]></category>
		<category><![CDATA[ejb]]></category>
		<category><![CDATA[stateless]]></category>

		<guid isPermaLink="false">http://javabeans.asia/2008/05/11/stateless_beans_and_annotations.html</guid>
		<description><![CDATA[Since EJB 3.0, it is possible to use JDK 5.0 metadata annotations to create EJB 3.0 Java beans. This makes the development very easy. The only drawback here as I see it, that in case when you want to change/add/remove &#8230; <a href="http://initbinder.com/articles/stateless_beans_and_annotations.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Since EJB 3.0, it is possible to use <a href="http://java.sun.com/developer/technicalArticles/releases/j2se15/" target="_blank">JDK 5.0 metadata annotations</a> to create EJB 3.0 Java beans. This makes the development very easy. The only drawback here as I see it, that in case when you want to change/add/remove annotation you actually have to recompile the class.</p>
<p>The example below shows how to create a stateless enterprise Java bean using annotations. The bean implements remote interface.</p>
<p><strong>The interface:</strong></p>
<p>[java]<br />
	package com.test.stateless.interfaces;</p>
<p>	import javax.ejb.Remote;</p>
<p>	@Remote<br />
         public interface StatelessTestRemote {<br />
		public void doSomething();<br />
	}<br />
[/java]</p>
<p>Annotation &#8220;<em>Remote</em>&#8221; specifies that the class is remote interface of the bean.</p>
<p><strong>The bean:</strong></p>
<p>[java]</p>
<p>package com.test.stateless.beans;<br />
import javax.ejb.Stateless;<br />
import org.jboss.annotation.ejb.RemoteBinding;<br />
import com.test.stateless.interfaces.StatelessTestRemote;</p>
<p>@Stateless<br />
@RemoteBinding(jndiBinding = &amp;quot;com/test/stateless/beans/StatelessTestBean/remote&amp;quot;)</p>
<p>	public class StatelessTestBean implements StatelessTestRemote {</p>
<p>	public void doSomething()  {</p>
<p>	}<br />
}<br />
[/java]</p>
<p>Annotation &#8220;<em>Stateless</em>&#8221; specifies that the class is stateless bean.<br />
Annotation &#8220;<em>RemoteBinding</em>&#8221; specifies JNDI name for the interface.</p>
<p>Keep in mind, that you can use @Remote in implementation bean itself, and it doesnt have to be inside the interface class. For example:</p>
<p>[java]<br />
@Stateless@Remote ({StatelessTestRemote.class})<br />
@RemoteBinding(jndiBinding = &amp;quot;com/test/stateless/beans/StatelessTestBean/remote&amp;quot;)</p>
<p>public class StatelessTestBean implements StatelessTestRemote {</p>
<p>[/java]</p>
<p>Thats it <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Update:<br />
</strong>As <span class="removed_link" title="http://www.java.net/blogs/ljnelson/">Laird Nelson</span> has pointed out in his response to this post, it is possible to override annotations in the XML descriptor. I looked into it, and yes indeed &#8211; EJB 3.0 allows to override the behavior of annotations in the source code. Although there are some limitations which annotations can be overridden. You can refer to article <a href="http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html/partial_deployment_descriptors.html" target="_blank">JBoss EJB 3.0 partial deployment descriptors</a> to find more detailed explanation about it <img src='http://initbinder.com/bunker/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://initbinder.com/articles/stateless_beans_and_annotations.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  initbinder.com/categories/beans/stateless-beans/feed ) in 0.19159 seconds, on May 18th, 2012 at 1:46 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 18th, 2012 at 2:46 pm UTC -->
