Announcement Announcement Module
No announcement yet.
set autocommit off is not longer suported - Spring + Hibernate Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • set autocommit off is not longer suported - Spring + Hibernate


    im starting whit spring and hibernate.... the hibernate properties are defined into applicationContext-hibernate.xml

    ------- applicationContext-hibernate.xml ------
    <!-- Configurer that replaces ${...} placeholders with values from a properties file -->
    <!-- (in this case, JDBC-related settings for the dataSource definition below) -->
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="location" value="/WEB-INF/"/>

    <!-- Local DataSource that works in any environment -->
    <!-- Note that DriverManagerDataSource does not pool; it is not intended for production -->

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName" value="${jdbc.driverClassName}"/>
    <property name="url" value="${jdbc.url}"/>
    <property name="username" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>

    <!-- Hibernate SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="mappingResources">
    <property name="hibernateProperties">
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.generate_statistics">true</prop>
    <prop key="hibernate.connection.autocommit">true</prop>
    <property name="eventListeners">
    <entry key="merge">
    <bean class=" IdTransferringMergeEventListener"/>

    ------------------ ---------------------

    # Properties file with JDBC-related settings.
    # Applied by PropertyPlaceholderConfigurer
    # from "applicationContext-hibernate.xml".

    hibernate.dialect=org.hibernate.dialect.PostgreSQL Dialect


    meanwhile, every time a transaction is executed (ex: getTemplate().doSave()), the error is thrown:

    java.sql.SQLException: ERROR: SET AUTOCOMMIT TO OFF is no longer supported

    I went to de PostgreSQL drive site (, and put it the drive (postgresql-8.0-314.jdbc3) in lib directory. But, when I start the TOMCAT, this happens:

    19/12/2005 12:55:27 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: RDBMS: PostgreSQL, version: 8.0.3
    19/12/2005 12:55:27 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 7.3.4 JDBC3 jdbc driver build 113

    I think so that TomCat was loading the wrong driver... how can I change this?????
    How the SPRING wrap the hibernate, i dont know what to do... (when a try first without the SPRING, HIBERNATE have no problems).

    PLEASE, i neeed HELP.

  • #2
    Ok I just solved this after some struggle so here's my 2c. Firstly, if you are using postgresql, the problem is definitely that you have a version of the driver that is too old. If you are running version 7.4 of postgres you need pg74.216.jdbc4.jar from

    If it still doesn't work, look for the following line in your log file during server startup:

    18173 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 7.4.5 JDBC3 with SSL (build 216)

    If you do not see this message, you have cached the wrong driver somewhere. In my case I am using myeclipse, and it actually deployed the old version to a few places in the .deployable directory since the jar was lying in $TOMCAT_HOME/common/lib. Search and delete it from anywhere you find it!