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. I propose of changing this behavior and mandate enlisted of connections if a JDO transaction is open, datastore or optimistic. "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."
