The behavior you're seeing is 'normal' but fixable. Consider that the
container can't actually tell if any of the bean's state has changed or
not. Therefore, it errs on the side of caution and always persists the
bean state. Actually, in BMP you'll notice that ejbStore always gets
called as well.
The solution to your problem is to implement a method 'boolean
isModified()' that returns true if and only if the bean's state has been
modified in the current transaction. You also want to create a jaws.xml
file for your bean and turn the 'tuned-updates' flag on (if your
patterns of modification are consistent - if not, this might just
interfere with the database's caching of query plans). You probably also
want 'has-pk-constraint' on when you initially deploy your bean, if
you're allowing JAWS to create the table for you.
See the documentation online at www.jboss.org for more details.
-danch
Chris DeGreef wrote:
> I am quite new to CMP. I am wondering why the database is being updated so
> often. Even when I am only (implicitly) retrieving rows.
>
> The most obvious case is when I issue a call to the home instance like
> "findByName". Everything appears to be working correctly unless I set the
> database debug flag on and look at the system.log. I see that the table was
> not only queried but actually updated.
>
> This was only a concern of efficiency until I added triggers to my database.
> Especially a trigger on "before update" that causes a field (called VERSION)
> in the table to be updated. I wouldn't want this trigger fired when I
> simple query the row.
>
> I would expect this type of action if I were updating the fields in the CMP
> object. However, I am not. All I do is send "getters" to it in order to
> populate my session bean. Do I need to set some options or something?
>
>
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user