Flush remote method for entity beans

WAS does not write changes made on the entity beans to the database until the time the transaction is committed. As a result, the database may get temporarily out of synchronization with the data cached in the entity bean's container.

A flush remote method is provided (in the com.ibm.commerce.base.helpers.BaseJDBCHelper class) that writes all the committed changes made in all transactions (it takes information from the enterprise bean cache) and updates the database. This remote method can be called by a command. Use this method only when absolutely required. It is expensive in terms of overhead resources and has a negative impact on performance.

Consider a logon command that includes the following code:

UserAccessBean uab = ...;
 uab.setRegisteredTimestamp(currentTimestamp);
 uab.commitCopyHelper();

Before the transaction is committed, the REGISTRATIONUPDATE in the USERS table is not updated with the current time stamp. The update only occurs when the transaction is committed. The flush method has to be used so that any direct JDBC query in the same transaction returns the user with the specified registration time stamp. For example: select from USERS where REGISTRATIONUPDATE

Related concepts

Extending the WebSphere Commerce object model with entity beans