Create new session beans

When creating new session beans, create them in the WebSphereCommerceServerExtensionsData project.


Task info

Use the wizard provided within Rational Application Developer to create the necessary classes for the new session bean. See Creating enterprise beans using wizards. WebSphere Commerce uses access beans in its programming model, and access beans do not support local interfaces. To use local interfaces, instead of using access beans, we must perform home lookup directly and cache it yourself for performance purposes. Your new session bean should extend the com.ibm.commerce.base.helpers.BaseJDBCHelper class. The superclass provides methods that allow you to obtain a JDBC connection object from the data source object used by the WebSphere Commerce Server, so that the session bean participates in the same transaction as the other entity beans. The following is an example of code to demonstrate the functions provided by the superclass:

In the preceding code example, the executeQuery method takes two input parameters. The first is a prepared statement and the second is a Boolean flag related to a cache flush operation. Set this flag to true if you need the container to flush all entity objects for the current transaction from the cache before executing the query. This would be required if you have performed updates on some entity objects and you need the query to search through these updated objects. If the flag were set to false those entity object updates would not be written to the database until the end of the transaction.

You should limit the use of this flush operation and generally set the flag to false, except in those cases where it is really required. The flush operation is a resource-intensive operation.


Related concepts
Extending the WebSphere Commerce object model with session beans
Extending the WebSphere Commerce object model