-
Bug
-
Resolution: Done
-
Major
-
4.2.0.GA_CP04, 4.3.0.GA_CP02
-
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)
- blocks
-
JBPAPP-983 Certify EAP 4.2/4.3 on DB2
- Resolved
- is incorporated by
-
JBPAPP-1214 Upgrade Hibernate to 3.2.4.SP1_CP06
- Resolved
- relates to
-
JBPAPP-1895 ANN-823 - Unit tests fail because Insert into ... values(upper(?)) fails on DB2
- Closed