You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Gunnar Hilling <ne...@hilling.de> on 2004/01/02 04:55:38 UTC

Rollback not working

When trying code i catch exception and do a tx.abort() when an error
occurs. But when the error is caused by an SQLException during tx.commit()
all changes done are written to the database...

this is a real problem for me. Shouldn't the db-commit be "all or nothing"
(rc5, postgres).

-Gunnar



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


Re: Rollback not working

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Gunnar,

Gunnar Hilling wrote:

> Hello and Thanks
> 
> Changed the CacheImpl, will try this soon. I have autocommit set to 0
> I think this is what i want, isn't it?
> 

I don't know what you want ;-)
If you use useAutoCommit=0 and your DB does use autoCommit 'true' by 
default for connections, you are in big trouble (because DB commit 
immediately).
In most cases default setting do the job, except if you are in a managed 
environment. If you want to do performance tuning then changing 
'useAutoCommit' will be helpful.

<snip from repository.dtd>
0 - OJB ignores the autoCommit setting of the connection and do not
         try to change it. This mode could be helpfully if the
         connection don't let you set the autoCommit state
         (e.g. using datasources from application server).
</snip>

regards,
Armin

> -Gunnar
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Re: Rollback not working

Posted by Gunnar Hilling <ne...@hilling.de>.
Hello and Thanks

Changed the CacheImpl, will try this soon. I have autocommit set to 0
I think this is what i want, isn't it?

-Gunnar



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


Re: Rollback not working

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Gunnar,

Gunnar Hilling wrote:
> When trying code i catch exception and do a tx.abort() when an error
> occurs. But when the error is caused by an SQLException during tx.commit()
> all changes done are written to the database...
> 
> this is a real problem for me. Shouldn't the db-commit be "all or nothing"
> (rc5, postgres).

Of course this should be the case. There is a bug in conjunction with 
proprietary TransactionExt#flush() method (OJB find new inserted objects 
in default cache implementation after abort). Workaround till fix could 
be to change the used ObjectCache from ObjectCacheDefaultImpl to 
ObjectCachePerBrokerImpl.

Or you have wrong 'useAutoCommit' setting in your 
jdbc-connection-descriptor? Default was 1.

regards,
Armin

> 
> -Gunnar
> 
> 
> 
> ---------------------------------------------------------------------
> 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