db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Bengtson <e...@jpox.org>
Subject Re: DatastoreConnection / optimistic txs
Date Sun, 08 Apr 2007 17:52:20 GMT
> I'm afraid I don't know what you mean by "this feature" and "this
> change". If you want to guarantee that the datastore connection you
> get is enlisted in the JDO transaction

tx.setOptimistic(true)
tx.begin()
//do some operations here
JDOConnection conn = tx.getDataStoreConnection();
conn.getNativeConnection().execute("UPDATE TABLEB SET A=1");
conn.close();
tx.rollback();

A flush may or may not be performed before "getDataStoreConnection" gets
invoked. If a flush is performed, the connection is enlisted in the
transaction.

So, accessing the datastore connection and doing updates is not portable, since
the connection may or may not be enlisted in the transaction.

The side effect of my change proposal would make it portable since connections
are always enlisted in the transaction :)

> we can add a flag to guarantee it.

I'm in favor of breaking backward compatibility and not adding a new flag,
because currently it's not ACID neither portable.


Mime
View raw message