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