HHH-5325 : Improvements to test suite (fixes HQLDB 2.0 failures)

This commit is contained in:
Gail Badner 2010-12-20 17:27:10 -08:00
parent 0ffe3690ec
commit bf6bd51c7e
10 changed files with 33 additions and 33 deletions

View File

@ -52,24 +52,24 @@ public class Staff {
@Column(name="size_in_cm")
@ColumnTransformer(
forColumn = "size_in_cm",
read = "size_in_cm / 2.54",
write = "? * 2.54" )
read = "size_in_cm / 2.54E0",
write = "? * 2.54E0" )
public double getSizeInInches() { return sizeInInches; }
public void setSizeInInches(double sizeInInches) { this.sizeInInches = sizeInInches; }
private double sizeInInches;
//Weird extra S to avoid potential SQL keywords
@ColumnTransformer(
read = "radiusS / 2.54",
write = "? * 2.54" )
read = "radiusS / 2.54E0",
write = "? * 2.54E0" )
public double getRadiusS() { return radiusS; }
public void setRadiusS(double radiusS) { this.radiusS = radiusS; }
private double radiusS;
@Column(name="diamet")
@ColumnTransformer(
read = "diamet / 2.54",
write = "? * 2.54" )
read = "diamet / 2.54E0",
write = "? * 2.54E0" )
public double getDiameter() { return diameter; }
public void setDiameter(double diameter) { this.diameter = diameter; }
private double diameter;

View File

@ -22,8 +22,8 @@
<property name="heightInches">
<column name="height_centimeters"
not-null="true"
read="height_centimeters / 2.54"
write="? * 2.54"/>
read="height_centimeters / 2.54E0"
write="? * 2.54E0"/>
</property>
<property name="currentAddress"
column="address"

View File

@ -15,8 +15,8 @@
<property name="weightPounds">
<column name="weight_kg"
not-null="true"
write="0.453 * ?"
read="weight_kg / 0.453"/>
write="0.453E0 * ?"
read="weight_kg / 0.453E0"/>
</property>
<property name="effectiveStartDate" column="eff_start_dt" type="java.util.Date"/>

View File

@ -307,7 +307,7 @@ public class ASTParserLoadingTest extends FunctionalTestCase {
results = s.createQuery( "from Human where name is not null" ).list();
assertEquals( 3, results.size() );
String query =
getDialect() instanceof DB2Dialect ?
( getDialect() instanceof DB2Dialect || getDialect() instanceof HSQLDialect ) ?
"from Human where cast(? as string) is null" :
"from Human where ? is null"
;
@ -2600,14 +2600,14 @@ public class ASTParserLoadingTest extends FunctionalTestCase {
* PostgreSQL >= 8.3.7 typecasts are no longer automatically allowed
* <link>http://www.postgresql.org/docs/current/static/release-8-3.html</link>
*/
if(getDialect() instanceof PostgreSQLDialect){
if(getDialect() instanceof PostgreSQLDialect || getDialect() instanceof HSQLDialect){
hql = "from Animal a where bit_length(str(a.bodyWeight)) = 24";
}else{
hql = "from Animal a where bit_length(a.bodyWeight) = 24";
}
session.createQuery(hql).list();
if(getDialect() instanceof PostgreSQLDialect){
if(getDialect() instanceof PostgreSQLDialect || getDialect() instanceof HSQLDialect){
hql = "select bit_length(str(a.bodyWeight)) from Animal a";
}else{
hql = "select bit_length(a.bodyWeight) from Animal a";

View File

@ -50,8 +50,8 @@
<property name="heightInches">
<column name="height_centimeters"
not-null="true"
read="height_centimeters / 2.54"
write="? * 2.54"/>
read="height_centimeters / 2.54E0"
write="? * 2.54E0"/>
</property>
<property name="intValue"/>
<property name="floatValue"/>

View File

@ -39,8 +39,8 @@
<property name="heightInches">
<column name="height_centimeters"
not-null="true"
read="height_centimeters / 2.54"
write="? * 2.54"/>
read="height_centimeters / 2.54E0"
write="? * 2.54E0"/>
</property>
<join table="address">
@ -73,8 +73,8 @@
<property name="login" column="u_login"/>
<property name="passwordExpiryDays">
<column name="pwd_expiry_weeks"
read="pwd_expiry_weeks * 7.0"
write="? / 7.0"/>
read="pwd_expiry_weeks * 7.0E0"
write="? / 7.0E0"/>
</property>
</join>
<join table="t_silly" fetch="select" optional="true">

View File

@ -38,8 +38,8 @@
<property name="heightInches">
<column name="height_centimeters"
not-null="true"
read="height_centimeters / 2.54"
write="? * 2.54"/>
read="height_centimeters / 2.54E0"
write="? * 2.54E0"/>
</property>
<component name="address">
@ -58,8 +58,8 @@
<property name="passwordExpiryDays">
<column name="pwd_expiry_weeks"
not-null="true"
read="pwd_expiry_weeks * 7.0"
write="? / 7.0"/>
read="pwd_expiry_weeks * 7.0E0"
write="? / 7.0E0"/>
</property>
<many-to-one name="manager"/>
</joined-subclass>

View File

@ -1939,7 +1939,7 @@ public class FooBarTest extends LegacyTestCase {
.addOrder( Order.asc("date") )
.list();
assertTrue( list.size()==1 && list.get(0)==f );
if(!(getDialect() instanceof TimesTenDialect)) {
if(!(getDialect() instanceof TimesTenDialect || getDialect() instanceof HSQLDialect)) {
list = s.createCriteria(Foo.class).setMaxResults(0).list();
assertTrue( list.size()==0 );
}

View File

@ -39,8 +39,8 @@
<property name="heightInches">
<column name="height_centimeters"
not-null="true"
read="height_centimeters / 2.54"
write="? * 2.54"/>
read="height_centimeters / 2.54E0"
write="? * 2.54E0"/>
</property>
</class>
@ -62,8 +62,8 @@
<property name="heightInches">
<column name="height_centimeters"
not-null="true"
read="height_centimeters / 2.54"
write="? * 2.54"/>
read="height_centimeters / 2.54E0"
write="? * 2.54E0"/>
</property>
</class>
@ -92,7 +92,7 @@
<property name="heightInches">
<column name="height_centimeters"
not-null="true"
read="height_centimeters / 2.54"/>
read="height_centimeters / 2.54E0"/>
</property>
</class>

View File

@ -37,8 +37,8 @@
<property name="heightInches">
<column name="height_centimeters"
not-null="true"
read="height_centimeters / 2.54"
write="? * 2.54"/>
read="height_centimeters / 2.54E0"
write="? * 2.54E0"/>
</property>
<component name="address">
@ -56,8 +56,8 @@
<property name="passwordExpiryDays">
<column name="pwd_expiry_weeks"
not-null="true"
read="pwd_expiry_weeks * 7.0"
write="? / 7.0"/>
read="pwd_expiry_weeks * 7.0E0"
write="? / 7.0E0"/>
</property>
<many-to-one name="manager"/>
</union-subclass>