Hi Erik,

On Apr 8, 2007, at 6:40 AM, Erik Bengtson wrote:

I have an optimistic transaction and I access the datastore connection. I perform some updates/inserts and rollback the transaction. The changes are not rolled back since the connection/transaction was not enlisted in the JDO optimistic transaction. This behavior is correct according the below paragraph
from the spec, but I disagree.

This behavior is mainly addressed to the optimization the JDO implementations do (releasing connections if it was only used to read - avoid locks), and SELECTs performed in native connection. It does not take into account the possibility
of performing UPDATEs, INSERTs or DELETEs.

You are correct that using a connection that is not associated with a datastore transaction means that any changes will not be associated with the optimistic transaction.

I propose of changing this behavior and mandate enlisted of connections if a JDO
transaction is open, datastore or optimistic.

This would change the semantics of optimistic transactions as soon as a datastore connection was acquired, essentially turning the optimistic transaction into a datastore transaction.

This is a backward-incompatible change. But maybe we should consider to request a datastore connection that would have that semantic by adding a boolean flag to the getDataStoreConnection method indicating that you want to be able to perform transactional updates with it.

Craig

"12.16 Access to internal datastore connection

If called in an optimistic transaction before flush has
been called, or outside an active transaction, the object returned will not be
enlisted in any transaction."


Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to