Uploaded image for project: 'Grails'
  1. Grails
  2. GRAILS-11151

"SQLException: Statement closed" with StatementCache jdbcInterceptor on jdk 1.6

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.6
    • Fix Version/s: None
    • Component/s: Persistence
    • Labels:
    • Environment:
      Ubuntu 12.04 x64, JDK 1.6.0_45-b06, Grails 2.3.6, hibernate4:4.3.1.2

      Description

      If datasource's jdbcInterceptors property contains 'StatementCache', the domain class contains "hasMany" property, jdk is 1.6 and hibernate4 plugin is 4.3.1.2, then save the domain instance will throw the "SQLException: Statement closed".

      In JDK 1.7 or Hibernate 3, the "StatementCache" works fine.

      Datasource configuration:

      DataSource.groovy
      dataSource {
          pooled = true
          jmxExport = true
          driverClassName = "org.h2.Driver"
          username = "sa"
          password = ""
          properties {
          	jdbcInterceptors = "StatementCache(max=200)"
          }
      }
      ......
      

      Domain Class:

      Foo.groovy
      class Foo {
          String name
          static hasMany = [strings: String]
      }
      

      The codes throw the exception:

      Map map = [name:"bar", strings:["1","2"]]
      new Foo(map).save(flush:true)
      

        Activity

        Hide
        Lari Hotari added a comment - - edited

        Could be related to this Hibernate issue:
        https://hibernate.atlassian.net/browse/HHH-8853

        "The Tomcat jdbc-pool won't let you call hashCode on the Statement object after it is closed. That's clearly a limitation (call it a bug or not) in the Tomcat jdbc-pool code."

        It looks like Hibernate 4.3.2 version will include a workaround for this problem.

        reported to Tomcat bugzilla:
        https://issues.apache.org/bugzilla/show_bug.cgi?id=56088

        Show
        Lari Hotari added a comment - - edited Could be related to this Hibernate issue: https://hibernate.atlassian.net/browse/HHH-8853 "The Tomcat jdbc-pool won't let you call hashCode on the Statement object after it is closed. That's clearly a limitation (call it a bug or not) in the Tomcat jdbc-pool code." It looks like Hibernate 4.3.2 version will include a workaround for this problem. reported to Tomcat bugzilla: https://issues.apache.org/bugzilla/show_bug.cgi?id=56088

          People

          • Assignee:
            Unassigned
            Reporter:
            Xiaoxiang Li
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: