[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ojb-user
Subject:    Re: Transaction rollback problem
From:       Armin Waibel <arminw () apache ! org>
Date:       2004-10-26 19:55:40
Message-ID: 417EABBC.6030209 () apache ! org
[Download RAW message or body]

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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic