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

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