Hi Armin,

On 05/08/05, Armin Waibel <[EMAIL PROTECTED]> wrote:
> if you set "useAutoCommit=1", OJB set the connection autoCommit
> attribute to 'false' when PB-tx demarcation is used. After the PB-tx the
> autoCommit attribute is reset to 'true'.
> http://db.apache.org/ojb/docu/guides/repository.html#useAutoCommit
> 
> Everything done between PB.begin... and PB.commit... will use the same
> connection with autoCommit 'false', thus on rollback nothing will be
> written to DB.

Thanks for your explanations.

That's pretty odd, but I still can't manage to make transactions work properly.

I tried the various autocommit options (0, 1, 2).

I also tried specifying explicitely the autocommit with:
broker.serviceConnectionManager().getConnection().setAutoCommit(false);

I tried changing my mapping (auto-insert/update/etc).

I also tried a different connection factory:
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
instead of the one I was using:
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
(in case my Tomcat 5.0 is in cause somehow with my datasource
definition or what not).

But I'm really clueless to what's happening there :-(

Even though I'm in between a beginTransaction and commitTransaction,
though there's just a few select queries, plus the broker.store()
operations, if there's some exception being thrown and I call
abortTransaction() in my catch block, it won't rollback all the stored
objects in my transaction -- if I can still call it a transaction
since it's not one anymore :-(

I wanted to make a smaller sample outside of a container, with an
ojb-blank app, but couldn't make it work on the command-line, so I
didn't pursue further.

What's odd also is this line in my debug logs:
ConnectionManagerImpl  - Release connection: connection is in local
transaction, missing 'localCommit' or 'localRollback' call - try to
rollback the connection

I see it just after I store my first object in my transaction. I'm
sure there's something about that, and I guess it's not normal.

If I set autocommit to 2 explicitely, I don't see it, but as soon as I
store my second object (depending on the first one with a FK), I get a
stacktrace saying it cannot insert my second object because the parent
one doesn't exist :-(

Any idea what could be wrong?

-- 
Guillaume Laforge
http://glaforge.free.fr/blog/groovy

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

Reply via email to