Announcement Announcement Module
No announcement yet.
hibernate + postgres + aoptransaction - rollback failed Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • hibernate + postgres + aoptransaction - rollback failed


    When inserting a record with unique index (on purpose), I encounter this in the log:

    2004-12-15 23:49:44,331 DEBUG [TP-Processor2] (org.springframework.orm.hibernate.HibernateTransa ctionManager:483) - Rolling back Hibernate transaction on session [net.sf.hibernate.impl.SessionImpl@ea85b4]
    2004-12-15 23:49:44,338 DEBUG [TP-Processor2] (net.sf.hibernate.transaction.JDBCTransaction:82) - rollback 2004-12-15 23:49:44,347 ERROR [TP-Processor2] (net.sf.hibernate.transaction.JDBCTransaction:90) - Rollback failed org.postgresql.util.PSQLException: Connection is closed. Operation is not permitted.
    Before posting a slew of codes, I'd like to find out if anyone has encounter this before ?

    Thanx and regards.


  • #2
    hibernate + c3p0 + transaction - c3p0 closing connection

    I dig further and I believe the sequence of event is this:

    1. insert record with dup key
    2. jdbc throws unique constraint exception
    3. c3p0 "sees" the exception and abandon the connection
    4. transaction manager "sees" the exception and try to rollback
    5. rollback fails because connection is closed (in 3 above).

    This is in the log:

    [c3p0] A PooledConnection died due to the following error!
    org.postgresql.util.PSQLException: ERROR: duplicate key violates unique constraint "users_username_key"

    Any "prefered way" to resolve this ? I think c3p0 should not abandon a connection under certain conditions (like constraint violation).



    • #3
      the latest c3p0 resolved the issue.