OPENJPA-1369: Change Order.count column name to save HSQLDB keyword name clash

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@832117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-11-02 21:43:17 +00:00
parent 760cf901ed
commit 90392e37d6
2 changed files with 11 additions and 5 deletions

View File

@ -36,6 +36,8 @@ import junit.framework.TestCase;
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.jdbc.sql.DerbyDictionary;
import org.apache.openjpa.jdbc.sql.HSQLDictionary;
import org.apache.openjpa.jdbc.sql.OracleDictionary;
import org.apache.openjpa.lib.jdbc.AbstractJDBCListener;
import org.apache.openjpa.lib.jdbc.JDBCEvent;
import org.apache.openjpa.lib.jdbc.JDBCListener;
@ -90,10 +92,12 @@ public abstract class AbstractCriteriaTestCase extends TestCase {
void setDictionary() {
JDBCConfiguration conf = (JDBCConfiguration) getEntityManagerFactory().getConfiguration();
dict = conf.getDBDictionaryInstance();
if (dict instanceof DerbyDictionary) {
if (dict instanceof DerbyDictionary || dict instanceof HSQLDictionary) {
dict.requiresCastForComparisons = false;
dict.requiresCastForMathFunctions = false;
}
} else if (dict instanceof OracleDictionary) {
dict.setJoinSyntax("sql92");
}
}
/**
@ -218,8 +222,8 @@ public abstract class AbstractCriteriaTestCase extends TestCase {
if (!jSQL.get(i).equals(expectedSQL)) {
printSQL("SQL for JPQL", jSQL.get(i));
printSQL("Expected SQL", expectedSQL);
assertEquals(i + "-th Expected SQL and SQL for JPQL: " + jpql + " are different", expectedSQL, jSQL
.get(i));
assertTrue(i + "-th Expected SQL and SQL for JPQL: " + jpql + " are different",
expectedSQL.equalsIgnoreCase(jSQL.get(i)));
}
}
}
@ -241,7 +245,7 @@ public abstract class AbstractCriteriaTestCase extends TestCase {
if (jSql.indexOf("optimize for 1 row") != -1)
jSql = jSql.substring(0, jSql.indexOf("optimize for 1 row")).trim();
if (!jSql.equals(expectedSQL)) {
if (!jSql.equalsIgnoreCase(expectedSQL)) {
printSQL("SQL for JPQL", jSql);
assertEquals(expectedSQL, jSql);
}

View File

@ -44,6 +44,8 @@ import javax.persistence.criteria.ParameterExpression;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.Subquery;
import org.apache.openjpa.persistence.test.DatabasePlatform;
/**
* Tests type-strict version of Criteria API. The test scenarios are adapted
* from TestEJBQLCondExpression in