Hi Guido,

On Apr 16, 2007, at 4:39 AM, Guido Anzuoni wrote:

Hi to all,
I agree that using datastore transaction term on the subject topic could
be very misleading.

There's always been a bit of confusion when talking about datastore transaction. In the proposed text, I've tried to use the term "native datastore transaction" when referring to the underlying transaction in the datastore.

What we are discussing here is the retain policy of the "connection" to
the native datastore the PM is applying.
According to Matthew proposal the result should be:

Connection getDataStoreConnection()

This method is equivalent to getDataStoreConnection
(pm.currentTransaction().isActive()). That is, it defaults to
getDataStoreConnection(true) if a JDO transaction is active, and
getDataStoreConnection(false) if not.

JDOConnection getDataStoreConnection(boolean enlist)

Regardless the type of transaction (optimistic or datastore),
if this method is called outside an active transaction, with the
enlist parameter false, the object returned will be a brand new connection obtained from the
underlying datastore engine.

Not exactly true if the jdo provider uses connection pooling.

If this method is called outside an active
transaction, with the enlist parameter true, JDOUserException is thrown.

If this method is called inside an active transaction the behavior is the
following:
Case l enlist=false
the object returned will be a brand new connection obtained by the
underlying datastore engine. The PersistenceManager will never deliberately use
the returned connection.

There's no difference between the connection returned here and any other connection that might be used for optimistic transactions. The main point is that the connections are auto-commit true and don't affect running transactions.

Case 2 enlist=true
If the PersistenceManager has already acquired a connection that it would use
for the rest of the transaction anyway, this connection is returned.
If the PersistenceManager has not acquired yet a connection that it would use
for the rest of the transaction, a new connection is obtained by the
underlying datastore engine and permanently assigned for the current transaction
management; this connection is then returned.

All this is true.

You present the information in a slightly different format. I'll review this when I write the text for the specification.

Thanks,

Craig


Guido.

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