Hi Guido,

it's not good

Guido Beutler wrote:
Hi,

I use OJB 1.0.0 inside of JBoss 3.2.3.
how to handle the following condition:

First I try to insert a row. This fails because of one required field wasn't filled and the transaction is rolled back.
After that I try to insert the same row again, this time with correct data. OJB then generates a update statement instead of a
insert statement and reports no kind of error. There are two things I don't understand:


1) why the objects are not removed from cache if the transaction is rolled back? Do I have to handle this and how?

It depends on the used ObjectCache implementation. ObjectCacheDefaultImpl have a property to trace objects cached during a PB-tx.


http://db.apache.org/ojb/api/org/apache/ojb/broker/cache/ObjectCacheDefaultImpl.html

ObjectCachePerBrokerImpl clear the cached objects on rollback, ...


2) why the SQL return code isn't checked for the number of updated rows. It would be possible to see in the return code that
there was no row updated, so it is clear that the cache must have been invalid.



In OJB1.1 the caching stuff will be completely refactored (+ real two level cache that push objects only after commit to the second level cache).
You are right. If an object will be updated we expect an row count of 1. Currently this check is only used in conjunction with optimistic-locking.


regards,
Armin


Thanks in advance ab best regards,

Guido

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to