--
---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
That is ... in JdbcTransaction we have:if (connection != null) {this.autoCommit = connection.getAutoCommit();if (this.autoCommit) {connection.setAutoCommit(false);}}I'd expect this to be a protected method that is overridden by AutoCommitJdbcTransaction (which bypasses that check) ... but that isn't the case.
So Ebean now flips it to false which is new behavior. I have set ebean.autoCommitMode=true and verified it in ServerConfig in the debugger.
Is this expected?
(Interestingly, if I take out the assertion on the autocommit that is failing, the rest of the unit test assertions pass, so I'm not really sure if there's a problem, I'm just reluctant to change the behavior.)
Thanks.
/Daryl
Logged as https://github.com/ebean-orm/avaje-ebeanorm/issues/392 ... and now fixed.I fixed up the test and it has much better asserts etc. I'll be rolling out the next release in a day or so (if you don't want to build it yourself).
--
Logged as https://github.com/ebean-orm/avaje-ebeanorm/issues/392 ... and now fixed.I fixed up the test and it has much better asserts etc. I'll be rolling out the next release in a day or so (if you don't want to build it yourself).
--
> AutoCommitJdbcTransaction is forAutoCommitJdbcTransaction expects that the DataSource provides connections with autoCommit = true ... AND that is what is desired (that the connection stays in autoCommit=true while Ebean is using it - that Ebean should not turn that off). That means is that commitTransaction() should not do anything because successful statements are already committed (and if it tries to commit it gets an error etc).
> or a good new patternIt is not supposed to be a new pattern in that it should be the same as 4.1.3 - #168 from July 2014.
So it would be new if you didn't use #416 (but I thought you were using this feature from around that time).
> I'm just wondering why Ebean can't open a transaction in autoCommit true mode.I'm thinking this means that sometimes the DataSource is giving Ebean connections with autoCommit=false and hence it isn't working? I think I need to confirm a few things:- Did you previously use #168 (so configure serverConfig.setAutoCommitMode(true) with 4.1.6 or above)
- Are the connections sometimes autoCommit=true and sometimes autoCommit=false
--
Ok, I'm going to 'jump' to a thought that ... if AutoCommitJdbcTransaction was changed such that:
- beginTransaction() was connection.executeUpdate("begin");
- commitTransaction() was connection.executeUpdate("commit");
- rollbackTransaction() was connection.executeUpdate("rollback");
... then that might be close to what you are wanting/expecting. In that case the connection is in autoCommit=true mode but we still want/expect transaction demarcation (and we get that via using the explicit executeUpdate("begin"); etc).
Is that closer to what you are thinking?
> When I mix JDBC transactions with Ebean
Does the code use Ebean's ExternalJdbcTransaction when it does this or some other approach?
Connection connection = ...
// do some raw JDBC stuff
// use Ebean with the same connection
Transaction txn = new ExternalJdbcTransaction(connection);
ebeanServer.save(someBean, txn);
I think that is exactly what I would expect. Ebean can work with all autoCommit true or all autoCommit false and the (external) behavior is the same.
Right, I dropped the ball on this - logged it just now as https://github.com/ebean-orm/avaje-ebeanorm/issues/415
Ok, that is in master. Note that Postgres wanted the explicit statements for commit and rollback (could not use connection.commit() or connection.rollback() when the underlying connection was autocommit=true with postgres - it gives an error).