Results 1 to 4 of 4

Thread: LocalTransaction rolled-back due to setRollbackOnly

  1. #1
    Join Date
    Aug 2006
    Posts
    27

    Default LocalTransaction rolled-back due to setRollbackOnly

    After switching to a WebSphere-defined datasource I am getting the error "LocalTransaction rolled-back due to setRollbackOnly". The link http://www-1.ibm.com/support/docview...id=swg21141640 explains this, but we are using Spring + Hibernate and need a Spring-level control to overcome this problem.

    The WebSphere approach of changing a property on all the servlets is very difficult, error-prone and a maintenance nightmare.

    One post I saw suggested a Hibernate workaround of setting a property on the transactionManager be to force a commit, but that syntax doesn't seem to be allowed in our version.

    Is there some way we can tell Spring (or Hibernate) to force autocommit on the sessions?

    Thanks,
    -- Frank

  2. #2
    Join Date
    Aug 2006
    Posts
    27

    Default

    By the way, in my bean defining my org.springframework.orm.hibernate3.LocalSessionFac toryBean I defined the property

    HTML Code:
    <prop key="hibernate.connection.autocommit">true</prop>
    and that didn't help.

    -- Frank

  3. #3
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    autocommit is a no go since you literally don't have transactions any more - the jdbc driver will commit when ever it feels like it. I'm not sure if there is an easy way out since WS is the one managing the transactions - hibernate and Spring only tell the TM what to do - is the TM who actually drives the transaction - if the TM wants to rollback (because the server exited) then there isn't much you can do).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  4. #4
    Join Date
    Oct 2006
    Location
    USA
    Posts
    4

    Default

    I received the same message when using hibernate2.
    I used the declarative transaction demarcation facilities in Spring 1.2.8 and the HibernateTemplate to manage my transaction.
    Evidently, WebSphere was able to see that all the DB resources were properly closed, and the rollback message disappeared. I tested using WSAD 5.1.2.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •