Hi Jeremy,

Thanks for clarifying the RelaxAutoCommit setting. What confuses me then
is that Scenario 2 always autocommits, even if I do this before getting
the connection:

em.getTransaction().begin();

It only stops autocommiting if I setAutocommit(false).

It seems as though the RESOURCE_LOCAL persistence unit always
autocommits even in the context of a transaction, unless one explicitly
turns autocommit off on the connection.

Paul

-----Original Message-----
From: Jeremy Bauer <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: Inconsistent Autocommit Handling
Date: Mon, 27 Oct 2008 09:46:57 -0500


Hi Paul,

The RelaxAutoCommit option appears to only allow transactional methods
to be called if a connection is not transactional.  From what I read,
it does not change the auto-commit value.  By default, auto-commit is
true for a connection per the JDBC spec.  I could have missed
something, but I did not see a MySQL connection property to change the
default for auto-commit.

When OpenJPA gets a connection it receives whatever auto-commit value
is set on the connection.  OpenJPA will however, set auto-commit to
false, if necessary, when you start a new transaction via tx.begin().
It will then change it back to the original value after a commit or
rollback.  IMHO, I don't think the two scenarios are bugs.

-Jeremy

Reply via email to