Invoking a Transactional Method

Refreshing Periodically

Use the refresh-period-in-seconds element
in the sun-ejb-jar.xml file to refresh a read-only
bean periodically.

If the value specified in refresh-period-in-seconds is zero or not specified, which is the default, the bean
is never refreshed (unless a transactional method is accessed).

If the value is greater than zero, the bean is refreshed
at the rate specified.

Note –

This is the only way to refresh the bean state if the
data can be modified external to the Enterprise Server.

By default, a single timer is used for all instances of a read-only
bean. When that timer fires, all bean instances are marked as expired
and are refreshed from the database the next time they are used.

Use the -Dcom.sun.ejb.containers.readonly.relative.refresh.mode=true flag to refresh each bean instance independently upon access
if its refresh period has expired. The default is false.
Note that each instance still has the same refresh period. This additional
level of granularity can improve the performance of read-only beans
that do not need to be refreshed at the same time.

To set this flag, use the asadmin create-jvm-options command. For example: