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 Staff(double sizeInInches, double radius, double diameter, Integer id) {
@Column(name="size_in_cm") @Column(name="size_in_cm")
@ColumnTransformer( @ColumnTransformer(
forColumn = "size_in_cm", forColumn = "size_in_cm",
read = "size_in_cm / 2.54", read = "size_in_cm / 2.54E0",
write = "? * 2.54" ) write = "? * 2.54E0" )
public double getSizeInInches() { return sizeInInches; } public double getSizeInInches() { return sizeInInches; }
public void setSizeInInches(double sizeInInches) { this.sizeInInches = sizeInInches; } public void setSizeInInches(double sizeInInches) { this.sizeInInches = sizeInInches; }
private double sizeInInches; private double sizeInInches;
//Weird extra S to avoid potential SQL keywords //Weird extra S to avoid potential SQL keywords
@ColumnTransformer( @ColumnTransformer(
read = "radiusS / 2.54", read = "radiusS / 2.54E0",
write = "? * 2.54" ) write = "? * 2.54E0" )
public double getRadiusS() { return radiusS; } public double getRadiusS() { return radiusS; }
public void setRadiusS(double radiusS) { this.radiusS = radiusS; } public void setRadiusS(double radiusS) { this.radiusS = radiusS; }
private double radiusS; private double radiusS;
@Column(name="diamet") @Column(name="diamet")
@ColumnTransformer( @ColumnTransformer(
read = "diamet / 2.54", read = "diamet / 2.54E0",
write = "? * 2.54" ) write = "? * 2.54E0" )
public double getDiameter() { return diameter; } public double getDiameter() { return diameter; }
public void setDiameter(double diameter) { this.diameter = diameter; } public void setDiameter(double diameter) { this.diameter = diameter; }
private double diameter; private double diameter;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1939,7 +1939,7 @@ public void testFindByCriteria() throws Exception {
.addOrder( Order.asc("date") ) .addOrder( Order.asc("date") )
.list(); .list();
assertTrue( list.size()==1 && list.get(0)==f ); 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(); list = s.createCriteria(Foo.class).setMaxResults(0).list();
assertTrue( list.size()==0 ); assertTrue( list.size()==0 );
} }

View File

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

View File

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