Re: "postgresql-9.0-801.jdbc4.jar" always cause "org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled" Exception
От | David Johnston |
---|---|
Тема | Re: "postgresql-9.0-801.jdbc4.jar" always cause "org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled" Exception |
Дата | |
Msg-id | 00e101cc1fba$26628270$73278750$@yahoo.com обсуждение исходный текст |
Ответ на | "postgresql-9.0-801.jdbc4.jar" always cause "org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled" Exception (Emi Lu <emilu@encs.concordia.ca>) |
Ответы |
Re: "postgresql-9.0-801.jdbc4.jar" always cause "org.postgresql.util.PSQLException:
Cannot commit when autoCommit is enabled" Exception
|
Список | pgsql-general |
> > SqlSession sql_session = sqlSessionFactory.openSession(false); > .... > sql_session.commit(); > > We'll presume that you intend (intentionally or otherwise) for auto-commit to be on since you do not reference any actual JDBC method calls here... > While for "8.4-702 JDBC 4", the same codes, no error at all. > > Is this a bug for "postgresql-9.0-801.jdbc4.jar"? > > Thanks a lot! > Emi > Arguably 8.4-702 was the bugged version and 9.0-801 corrects the behavior - or rather enforces the fact you should not be in auto-commit mode AND committing manually. Since this is a major version change such a behavioral change is to be expected. It should also at least be documented - but whether it is or not I do not know. I would recommend disabling auto-commit and leaving your commit() calls in place. You are generally much better off dealing with transaction logic explicitly instead of relying upon the driver to do it for you; though there are always exceptions but you should code is so that you can request an auto-commit session when you know you need one. David J.
В списке pgsql-general по дате отправления: