Why does the Sun j2EE Reference Implementation invoke ejbLoad() and ejbStore() twice in a row?

Bozidar Dangubic

Container has a contract with the developers to provide certain things such as security, transactions, ... The way in which application server does this is up to the implementation.

What you are seeing with multiple callbacks is not suprising. Most appllication servers allow you to specify to a certain extent when the callbacks occur.

Orion Application Server offers isModified() method which is called before any callback. If isModified() (which you implement) returns false, the callbacks will not be invoked.

Without these kinds of optimization techniques, you will see many callbacks most of which will not make sense to you.