Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-7393

HibernateException is thrown during borrow connection after any query execution in RowMapper

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.0 GA, 3.0.1, 3.0.2, 3.0.3
    • Fix Version/s: 3.0.4
    • Component/s: Core, Transaction
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      We have some DAO which call an other DAO in RowMapper to get linked entities. Sometimes we have to do that to link different loosely coupled entities in depends of included application modules, data base state etc. After migration from Spring 2.5.6 to Spring 3.X we've got the following issue:

      org.hibernate.HibernateException: connnection proxy not usable after transaction completion
      at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:66)
      at $Proxy6.prepareStatement(Unknown Source)
      at org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl.createPreparedStatement(PreparedStatementCreatorFactory.java:245)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:580)

      It happens on prepared statement creation for query need to be executed after execution any SQL statement in DAO called from RowMapper. I've created Unit test to show this incident.

        Issue Links

          Activity

          Hide
          juergen.hoeller Juergen Hoeller added a comment -

          Good catch! After addressing SPR-6895 for Spring 3.0.2, HibernateJpaDialect was closing borrowed connections too aggressively, which led to failure for nested JDBC executions. I've fixed this for Spring 3.0.4 now.

          This fix will be available in tonight's 3.0.4 snapshot. Feel free to give it an early try...

          Juergen

          P.S.: Thanks for the unit test - that helped a lot!

          Show
          juergen.hoeller Juergen Hoeller added a comment - Good catch! After addressing SPR-6895 for Spring 3.0.2, HibernateJpaDialect was closing borrowed connections too aggressively, which led to failure for nested JDBC executions. I've fixed this for Spring 3.0.4 now. This fix will be available in tonight's 3.0.4 snapshot. Feel free to give it an early try... Juergen P.S.: Thanks for the unit test - that helped a lot!
          Hide
          snicoll Stéphane Nicoll added a comment -

          Juergen,

          I tried today's nightly build and it fixed indeed this exception I got by upgrading from 2.5.6 to 3.0.3. (works with 3.0.0). I had this issue a lot combined with database access with Spring Batch. Right now, I still have 6 tests failing which I am currently investigating.

          Thanks!

          Show
          snicoll Stéphane Nicoll added a comment - Juergen, I tried today's nightly build and it fixed indeed this exception I got by upgrading from 2.5.6 to 3.0.3. (works with 3.0.0). I had this issue a lot combined with database access with Spring Batch. Right now, I still have 6 tests failing which I am currently investigating. Thanks!
          Hide
          snicoll Stéphane Nicoll added a comment -

          Juergen,

          Works for us! The 6 tests failing are unrelated to this.

          Show
          snicoll Stéphane Nicoll added a comment - Juergen, Works for us! The 6 tests failing are unrelated to this.
          Hide
          rwinch Rob Winch added a comment -

          I'm not sure what the policy is on updating the components since this is closed, but I noticed this was logged against core and transaction, but the changes in the source tab were in jdbc. This made tracking down the root cause of SEC-1778 slightly more difficult. While it only made it slightly more complicated to find the issue, it would be nice to get this updated. Can someone associate this JIRA to the proper component (Data:JDBC)?

          Show
          rwinch Rob Winch added a comment - I'm not sure what the policy is on updating the components since this is closed, but I noticed this was logged against core and transaction, but the changes in the source tab were in jdbc. This made tracking down the root cause of SEC-1778 slightly more difficult. While it only made it slightly more complicated to find the issue, it would be nice to get this updated. Can someone associate this JIRA to the proper component (Data:JDBC)?

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              borislav.andruschuk Andruschuk Borislav
              Last updater:
              Rob Winch
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 22 weeks, 5 days ago