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

HHH-4580 - Option 'ansinull off' in Sybase causes AssertionFailure in QueryByExampleTest

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: EAP 5.0.0, 4.2.0.GA_CP08, 4.3.0.GA_CP07
    • Fix Version/s: TBD
    • Component/s: Hibernate
    • Labels:
      None
    • Environment:

      Sybase 15

    • Affects:
      Release Notes
    • Workaround Description:
      Hide

      The workaround to this kind of problem is to append the following string to the JDBC URL:

      ?SQLINITSTRING=set ansinull on

      If it's not possible, the following java code (or similar) can be executed after getting a Hibernate Session (represented here as "s"):
      s.connection().createStatement().execute("set ansinull on");

      Show
      The workaround to this kind of problem is to append the following string to the JDBC URL: ?SQLINITSTRING=set ansinull on If it's not possible, the following java code (or similar) can be executed after getting a Hibernate Session (represented here as "s"): s.connection().createStatement().execute("set ansinull on");
    • Release Notes Text:
      Hide
      <para>The QueryByExampleTest.testJunctionNotExpressionQBE builds a disjunction predicate such as ( OR^ (ex) (NOT ex) ). The test fails in Sybase because ansinull is set to off by default. This should match everything in the database, but because ANSI SQL evaluates all comparisons involving NULL values as UNKNOWN, not all matches are returned. The following workarounds exist:</para><orderedlist><listitem><para>Append the following string to the JDBC URL:
      <literal>?SQLINITSTRING=set ansinull on</literal></para></listitem><listitem><para>Execute the following Java code (or similar) after obtaining a Hibernate session s:
      <literal>s.connection().createStatement().execute(&quot;set ansinull on&quot;);</literal></para></listitem></orderedlist>
      Show
      <para>The QueryByExampleTest.testJunctionNotExpressionQBE builds a disjunction predicate such as ( OR^ (ex) (NOT ex) ). The test fails in Sybase because ansinull is set to off by default. This should match everything in the database, but because ANSI SQL evaluates all comparisons involving NULL values as UNKNOWN, not all matches are returned. The following workarounds exist:</para><orderedlist><listitem><para>Append the following string to the JDBC URL: <literal>?SQLINITSTRING=set ansinull on</literal></para></listitem><listitem><para>Execute the following Java code (or similar) after obtaining a Hibernate session s: <literal>s.connection().createStatement().execute(&quot;set ansinull on&quot;);</literal></para></listitem></orderedlist>
    • Release Notes Docs Status:
      Not Required

      Description

      Test QueryByExampleTest.testJunctionNotExpressionQBE fails due to the option "ansinull" having the default value of "off" in Sybase 15. The test expects two records as a result for a query, but it gets 3. After some debugging with the query that Hibernate generated, I end up with these two simpler ones:

      select id from Componentizable where not (name like ? and subName1 like ?)

      select id from Componentizable where not (name like 'hibernate' and subName1 like 'ope%')

      The first one returns three records, while the second returns two. The interesting part is that if I replace the first parameter in the first query by a hardcoded value ("hibernate"), it still returns 3 records. That means that the problem is probably with the binding of JDBC parameters containing a wildcard % .

      http://opensource.atlassian.com/projects/hibernate/browse/HHH-4580

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                stliu Strong Liu
                Reporter:
                juraci.costa Juraci Paixão Kröhling
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: