Avoiding ejbStore invocations on non-modified EntityBean instances
We can configure the EntityBean instances to bypass an invocation of the ejbStore method if they have not been modified during the current transaction.
There are two options available for indicating that a particular EJB type should only have its ejbStore method invoked if the bean has been modified during the current transaction:
- Set an EJB environment variable within the bean's deployment descriptor
- Have the bean implementation class implement a marker interface. This second technique is especially useful if we have a number of bean implementations that all extend a single root class; in this case you may have the root class implement the marker interface, causing all beans that extend this class to inherit the behavior as well.
- To use the EJB environment variable technique, edit the EJB deployment descriptor using any standard Java EE development tool. Use the following steps as a guide. For more information, see the topic about assembly tools.
- Start the tool.
- Select the EJB deployment descriptor of the bean to work with.
- Create an EJB environment variable with the name com/ibm/websphere/ejbcontainer/disableEJBStoreForNonDirtyBeans.
- Set the type of this variable to java.lang.Boolean.
- Set the value to True to avoid the ejbStore invocation, or False to enable the default behavior.
- Save the changes.
- To use a marker interface, code the bean implementation class to implement the com.ibm.websphere.ejbcontainer.DisableEJBStoreForNonDirtyBeans interface. The bean implementation class need not directly implement the interface; any parent class can implement the interface. See the com.ibm.websphere.ejbcontainer package in the Reference > Programming interfaces > APIs - Application Programming Interfaces section of the information center.
Related concepts
Development and assembly tools