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 Goncalo Luiz <ge...@grace.no-ip.org> on 2003/06/29 22:20:13 UTC

Transaction problems...

Hello.
While writing some junit tests for my app, I realized that when I call the method broker.store(), the object is immedialty written to the database, even before I call broker.commit(). As far as I am concerned it was supposed to allow me to do the following:
- begin transaction;
- create the user with name "gedl".
- commit transaction;
- begin transaction;
- create ANOTHER user with name "gedl";
- rollback transaction;
But the call to borker.rollback() isn't reached, because it thorws a databse exception on the violation of the unique key.

Am I missing something ?
I'm using the PersistenceBroker API.
----
Gonçalo Luiz - IST 4º Ano (PSI) 
gedl@grace.no-ip.org

Re: Transaction problems...

Posted by Thomas Mahler <th...@web.de>.
Hi Gonzalo,

works as designed!
broker.store() writes to the database!
the transaction opened by beginTransaction() is an ordinary JDBC 
transaction.

with the ODMG API you have full object level transaction, where DB 
access only happens during transaction Commit.

cheers,
Thomas

Goncalo Luiz wrote:
> Hello.
> While writing some junit tests for my app, I realized that when I call the method broker.store(), the object is immedialty written to the database, even before I call broker.commit(). As far as I am concerned it was supposed to allow me to do the following:
> - begin transaction;
> - create the user with name "gedl".
> - commit transaction;
> - begin transaction;
> - create ANOTHER user with name "gedl";
> - rollback transaction;
> But the call to borker.rollback() isn't reached, because it thorws a databse exception on the violation of the unique key.
> 
> Am I missing something ?
> I'm using the PersistenceBroker API.
> ----
> Gonçalo Luiz - IST 4º Ano (PSI) 
> gedl@grace.no-ip.org