1 Reply Latest reply on Nov 23, 2003 6:21 AM by Marius Krabset

    How to disable autocommit for local-tx-datasource

    Marius Krabset Newbie

      Hi, I have a problem with my datasource-configuration (I think).
      I'm using the combination jboss-3.2.2/hibernate2/postgresql-7.3, and get a:

      [B]
      java.sql.SQLException: You cannot commit with autocommit set!
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:494)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:465)
      at net.sf.hibernate.id.TableGenerator.generate(TableGenerator.java:126)
      at net.sf.hibernate.id.TableHiLoGenerator.generate(TableHiLoGenerator.java:59)
      at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:599)
      ...
      ...
      [/B]

      ...each time I try to save an object. I've tried to setAutoCommit(false) on the WrappedConnection, but it didn't seem to help.

      Is there a way to configure the datasource so that it produces connections with autocommit disabled?

      My datasource-config looks like this:
      [B]
      <?xml version="1.0" encoding="UTF-8"?>

      <local-tx-datasource>
      <jndi-name>MyDS</jndi-name>
      <connection-url>jdbc:postgresql://localhost:5432/mydb</connection-url>
      <driver-class>org.postgresql.Driver</driver-class>
      <user-name>username</user-name>
      password
      </local-tx-datasource>

      [/B]
      -Marius