dirty or not
when using BMP to implement persistence, we have to implemente a few ejb funtions:
ejbCreate(), ejbStore(), ejbLoad(), ejbRemove and etc.
When a ejb bean is loaded, no matter it's changed or not, when it's not needed, ejbStore() method will be executed to store the ejb object to database. what a waste!
Cause it's BMP, you have to control everything by yourself. (with CMP, you should not have to consider about that)
Anyway, we have to do something. yes, add a switch to inform the ejbStore() method what to do. dirty or not.
Assume we are using value object all the place, add one boolean variable to your value object, say dirty. In your ejbStore() method, add a little condition to check if it's dirty before storing the object back to database.
Though I know ejb and have been using it for a long time, I don't actually like it. BMP means too much work, CMP means hard to control. both are hard to deploy cause never independant to application server. I think that's why people like JDO stuff. Recently, I saw a book "J2EE development without ejb", I can fully understand why such book is there. You must know, ejb is the core part of J2EE structure.
By the way, the ejb I'm talking is persistence ejb, not session bean. Session bean is good.