Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-948

HHH-3501 - ASTParserLoadingTest testing unsupported queries for DB2

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.2.0.GA_CP05, 4.3.0.GA_CP03
    • 4.2.0.GA_CP04, 4.3.0.GA_CP02
    • Hibernate
    • None
    • JUnit tests with DB2

    • Release Notes

      The org.hibernate.test.hql.ASTParserLoadingTest test is testing some unsupported queries for DB2. A code to skip HSQLDB already exists in code, and needs to be improved to skip DB2 as well. The original code is:

      if ( ! ( getDialect() instanceof HSQLDialect ) )

      { // HSQLDB does not like the abs(? - ?) syntax... s.createQuery( "from Animal where abs(:x - :y) < 2.0" ).setLong( "x", 1 ).setLong( "y", 1 ).list(); }

      s.createQuery( "from Animal where lower(upper(:foo)) like 'f%'" ).setString( "foo", "foo" ).list();
      s.createQuery( "from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0" ).setLong( "param", 1 ).list();
      s.createQuery( "from Animal where lower(upper('foo') || upper(:bar)) like 'f%'" ).setString( "bar", "xyz" ).list();

      Fixed code is:

      if ( ! ( getDialect() instanceof HSQLDialect || getDialect() instanceof DB2Dialect ) )

      { // HSQLDB does not like the abs(? - ?) syntax... s.createQuery( "from Animal where abs(:x - :y) < 2.0" ).setLong( "x", 1 ).setLong( "y", 1 ).list(); }

      if (! (getDialect() instanceof DB2Dialect))

      { s.createQuery( "from Animal where lower(upper(:foo)) like 'f%'" ).setString( "foo", "foo" ).list(); s.createQuery( "from Animal where lower(upper('foo') || upper(:bar)) like 'f%'" ).setString( "bar", "xyz" ).list(); }

      s.createQuery( "from Animal a where abs(abs(a.bodyWeight - 1.0 + :param) * abs(length('ffobar')-3)) = 3.0" ).setLong( "param", 1 ).list();

      The DB2 errors are:
      http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/core/rsql0400.htm

      SQL -417 - A statement string to be prepared contains parameter markers as the operands of the same operator. (for the first exception)
      SQL -418 - A statement contains a use of a parameter marker that is not valid. (for the two other exceptions)

            gbadner@redhat.com Gail Badner (Inactive)
            jpkroehling@redhat.com Juraci Paixão Kröhling (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: