For BMP, I don't want all the variables to be updated in the database when only one variable has been changed in each of the business methods. Is it a good practice to load and store values from and to database inside the business methods rather than ejbStore() and ejbLoad()?

Matthias David

Placing load and store commands inside business methods is not a good practice. Imagine if you have several calls to business methods to the bean, in this case you would have database access on each business method call.
Using the ejbStore() and ejbLoad() methods guarantee that the database access takes place when it is really necessary, e.g. between transcations.
If only some of the variables change between calls of ejbLoad() and ejbStore() then an approach to use would be to store which variables have changed using transient boolean flags and then write only these variables to the database.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact