I am creating a BMP entity bean.
I noticed that after a call to one of my getXXX() methods. The ejbStore() is called.
How do I prevent the ejbStore() from being called. I am just getting access to data that has been loaded via ejbLoad() and am not modifying any properties within the bean.
It is usually doen to the transaction scope. ejbLoad and ejbStore are typically called at the start and end of each transaction (there are many optimisations that can be made here and it also depends on many other factors not least of which is the commit option, but this is generally the case)
It is likely that your entity bean is configured to have it's method run in the context of a transaction, such that every time a method is called it runs in its own transaction. Have a look at the transaction attribute on the entity bean.
Best to have a facade in front of the bean and have this create any transaction you need, then have the entity bean set at supports or mandatory depending on how you want to use the entity bean.
This was one of the major causes of problems in early adoptions of entity beans.
In my opinion, the ejbStore() method is called by the container to synchronize the state of the EJB to the underlying datastore during business method invocations. Which means it is a medium of ensuring data integrity.
When and how to call the ejbStore() method, is specific to each Application Server/container. Ideally you should not try to disable the call on the ejbStore() after any business methods (although it may be resource intensive).
The reason for introducing the ejbLoad() and ejbStore() method is: in case there are many concurrent users accessing the same db table row (by accesing the Entity bean) and are concurrently modifying its data, how do you ensure that data corruption is prevented and transactions are not voilated for concurrent users. The answer to the question was to 'read data from the datastore before modifying it, and immediately update it as soon as the business method is completed'. Having said that, ejbLoad() and ejbStore() methods are called during business method invocations, to ensure data integrity.
I agree it may slow the performance, just in case you looking for performance (typically report generations), I would suggest you to use Data Access Objects rather than entity beans.
Hope this answers your question.