Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

In EJB3.0, most of the deployment descriptor tasks declarations can be specified done through the corresponding annotations in the bean class. However, if a deployment descriptor is supplied (ejb-jar.xml), the declarations in the deployment descriptor will override the annotations.

The ejb module connects to back end datasource using it's its JNDI name jdbc/DataSource as declared in the ejb-jar.xml. It also declares that the ejb is a stateless session bean and provides an interceptor class for the bean. The interceptor class will have callback methods which container calls when the corresponding events occur in the bean's life cycle.

...

Code Block
XML
XML
borderStylesolid
titleejbopenejb-jar.xml
<openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2" 
         xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2" 
         xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" 
         xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">

   <sys:environment>
        <sys:moduleId>
            <sys:groupId>samples</sys:groupId>
            <sys:artifactId>EmployeeDemo-ejb-dd</sys:artifactId>
            <sys:version>3.0</sys:version>
            <sys:type>jar</sys:type>
        </sys:moduleId>
    	
         <sys:dependencies>
			   <sys:dependency>
                <sys:groupId>console.dbpool</sys:groupId>
                <sys:artifactId>jdbc%2FEmployeeDatasource</sys:artifactId>
                <sys:version>1.0</sys:version>
                <sys:type>rar</sys:type>
            </sys:dependency>
		 </sys:dependencies>
    </sys:environment>
	
	<enterprise-beans>
		<session>
			<ejb-name>RetrieveEmployeeInfoBean</ejb-name>
			   <naming:resource-ref>
					 <naming:ref-name>
					jdbc/DataSource
     jdbc/DataSource
                            </naming:ref-name>
					         <naming:resource-link>jdbc/EmployeeDatasource</naming:resource-link>
				   </naming:resource-ref>
		</session>
	</enterprise-beans>
</openejb-jar>	

...