OPENJPA-703 fix TestOptimizeForClause testcase

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@741745 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2009-02-06 21:43:53 +00:00
parent 72fa143e53
commit ed3889ff69
1 changed files with 13 additions and 11 deletions

View File

@ -44,19 +44,21 @@ public class TestOptimizeForClause
DBDictionary dict = ((JDBCConfiguration) em.getConfiguration())
.getDBDictionaryInstance();
em.getTransaction().begin();
AllFieldTypes a = new AllFieldTypes();
a.setIntField(123);
em.persist(a);
em.getTransaction().commit();
em.clear();
sql.clear();
Object result = em.createQuery
("select o from AllFieldTypes o where o.intField = 123").
getSingleResult();
try {
Object result = em.createQuery
("select o from AllFieldTypes o where o.intField = 0").
getSingleResult();
assertNull(result);
if (dict instanceof DB2Dictionary ) {
assertContainsSQL(" optimize for 1 row");
}
} catch (NoResultException pe) {
;
assertNotNull(result);
if (dict instanceof DB2Dictionary ) {
assertContainsSQL(" optimize for 1 row");
}
em.close();
}