Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (10.1.3.5.0)

Part Number E13981-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Configuring OC4J-Proprietary Deployment Options on an EJB 3.0 Session Bean

You can configure OC4J-proprietary deployment options for an EJB 3.0 session bean using OC4J-proprietary annotations (see "Using Annotations") or using the orion-ejb-jar.xml file (see "Using Deployment XML").

Configuration in the orion-ejb-jar.xml file overrides the corresponding configuration made using OC4J-proprietary annotations.

Using Annotations

You can specify OC4J-proprietary deployment options for an EJB 3.0 session bean using the following OC4J-proprietary annotations:

  • @StatelessDeployment: for stateless session beans.

  • @StatefulDeployment: for stateful session beans.

Example 5-10 shows how to configure OC4J-proprietary deployment options for an EJB 3.0 stateless session bean using the @StatelessDeployment annotation.

For more information on @StatelessDeployment attributes, see Table A-1.

Example 5-10 @StatelessDeployment

import javax.ejb.Stateless;
import oracle.j2ee.ejb.StatelessDeployment;

@Stateless
@StatelessDeployment(
    minInstances=5,
    poolCacheTimeout=90
)
public class HelloWorldBean implements HelloWorld {
    public void sayHello(String name) {
        System.out.println("Hello "+name +" from first EJB3.0");
    }
}

Example 5-11 shows how to configure OC4J-proprietary deployment options for an EJB 3.0 stateful session bean using the @StatefulDeployment annotation.

For more information on @StatefulDeployment attributes, see Table A-1.

Example 5-11 @StatefulDeployment

import javax.ejb.Stateful
import oracle.j2ee.ejb.StatefulDeployment;

@Stateful
@StatefulDeployment(
    idletime=100
    passivateCount=3
)
public class CartBean implements Cart {
    private ArrayList items;
    ...
}

Using Deployment XML

You can specify OC4J-proprietary deployment options using the orion-ejb-jar.xml file element <session-deployment> as Example 5-12 shows.

For more information on the <session-deployment> element, see "<session-deployment>".

Example 5-12 orion-ejb-jar.xml File <session-deployment> Element

<?xml version="1.0" encoding="utf-8"?>
<orion-ejb-jar
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd"
    deployment-version="10.1.3.1.0"
    deployment-time="10b1fb5cdd0"
    schema-major-version="10" 
    schema-minor-version="0"
>
    <enterprise-beans>
        <session-deployment
            name="MBeanServerEjb"
            call-timeout="0"
            location="MBeanServerEjb"
            local-location="admin_ejb_MBeanServerEjbLocal"
            timeout="0"
            ...
        >
        </session-deployment>
    ...
    </enterprise-beans>
    ...
</orion-ejb-jar>