| ||||||||||||
| Technology Exponent | ||||||||||||
|
EJB Cheat Sheet Quick reminder of EJB types and configurations
EJB Types
Interfaces To Extend
Local interfaces introduced in EJB 2.0. Client uses these extending interfaces. Class
Implement one of the interfaces (but not EJBHome or EJBObject):
The class will implement the business methods defined in EJBObject. ejb-jar.xml Deployment Descriptor
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>MySessionBean</ejb-name>
<home>InterfaceThatExtendsEJBHome</home>
<remote>InterfaceThatExtendsEJBObject</remote>
<ejb-class>ClassThatExtendsSessionBean</ejb-class>
<session-type>Stateful | Stateless</session-type> <!-- this is how the container knows the type -->
<transaction-type>Container | Bean</transaction-type>
</session>
<entity>
<ejb-name>MyEntityBean</ejb-name>
<home>InterfaceThatExtendsEJBHome</home>
<remote>InterfaceThatExtendsEJBObject</remote>
<ejb-class>ClassThatExtendsEntityBean</ejb-class>
<persistence-type>Bean | Container</persistence-type>
<reentrant>False</reentrant>
</entity>
<message-driven>
<ejb-name>MyMDB</ejb-name>
<ejb-class>ClassThatImplementsMessageDrivenBeanAndMessageListener</ejb-class>
<transaction-type>Container | Bean</transaction-type>
<message-driven-destination>
<destination-type>javax.jms.Topic</destination-type>
<subscription-durability>NonDurable</subscription-durability> <!-- msg will be lost if server go down -->
</message-driven-destination>
</message-driven>
...
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>MyEntityBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>myMethod*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Transactions
ACID: Atomic, Consistent, Isolated, Durable
Two-Phase Commit
Transaction Types
|
|||||||||||
|
|||||||||||
| # of hits, all:3689, today:3 | Copyright © 2000-2010 Technology Exponent | Build:2009.03.28:00.59.42 EDT |