Hi Guillaume,

> 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 :-(

I'm clueless too.
ConnectionFactoryManagedImpl is only needed when delegate the tx-demarcation to JTA-api. I assume you have checked the datasource settings in tomcat and the tx-settings in your DB.

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

This is really interesting, because OJB seems to release a connection while a running PB-tx. ConnectionManager#releaseConnection was called by PersistenceBroker#close() method.
Do you close the used PB instance before ending of PB-tx demarcation end?
Do you use
PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl
in OJB.properties file?

regards,
Armin


Guillaume Laforge wrote:
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?


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

Reply via email to