Stateless Session EJB: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=Internal=


* [[JEE#Subjects|JEE]]
* [[EJB#Subjects|EJB]]


=Overview=
=Overview=


A stateless session bean as per its name does not have any associated client state, but it may preserve its instance state.
A stateless session bean as per its name does not have any associated client state, but it may preserve its instance state. For more EJB concepts see {{Internal|EJB Concepts|EJB Concepts}}


=Example=
=Example=


{{External|https://github.com/NovaOrdis/playground/tree/master/jee/ejb/stateless}}
* Stateless EJB and Servlet deployed as separate modules, EJB is looked up in JNDI: https://github.com/NovaOrdis/playground/tree/master/jee/ejb/stateless-and-servlet-different-deployment-units-same-jboss-instance
 
* Stateless EJB and Servlet deployed part of the same EAR, annotations: https://github.com/NovaOrdis/playground/tree/master/jee/ejb/stateless-and-servlet-within-ear-ejb-annotation
* Stateless EJB and Servlet deployed part of the same EAR, JNDI lookup: https://github.com/NovaOrdis/playground/tree/master/jee/ejb/stateless-and-servlet-within-ear-jndi


=Maven=
=Maven=
Line 22: Line 23:
</dependency>
</dependency>
</pre>
</pre>


=Stateless EJB and JNDI=
=Stateless EJB and JNDI=


bindings for session bean named 'SimpleStatelessBean' in deployment unit 'deployment "stateless-ejb-example.jar"' are as follows:
{{Internal|EJB_Concepts#EJB_and_JNDI|EJB and JNDI}}
 
<pre>
java:global/stateless-ejb-example/SimpleStatelessBean!io.novaordis.playground.jee.ejb.stateless.SimpleStateless
java:app/stateless-ejb-example/SimpleStatelessBean!io.novaordis.playground.jee.ejb.stateless.SimpleStateless
java:module/SimpleStatelessBean!io.novaordis.playground.jee.ejb.stateless.SimpleStateless
java:jboss/exported/stateless-ejb-example/SimpleStatelessBean!io.novaordis.playground.jee.ejb.stateless.SimpleStateless
java:global/stateless-ejb-example/SimpleStatelessBean
java:app/stateless-ejb-example/SimpleStatelessBean
java:module/SimpleStatelessBean
</pre>

Latest revision as of 13:35, 1 May 2017

Internal

Overview

A stateless session bean as per its name does not have any associated client state, but it may preserve its instance state. For more EJB concepts see

EJB Concepts

Example

Maven

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
</dependency>

Stateless EJB and JNDI

EJB and JNDI