em = emf.createEntityManager();
assertNotNull(em);
try {
long startTime = System.currentTimeMillis();
QTimeout qt = em.find(QTimeout.class, new Integer(1));
em.getTransaction().begin();
qt.setStringField("updated");
em.flush();
em.getTransaction().commit();
long endTime = System.currentTimeMillis();
long runTime = endTime - startTime;
getLog().trace("testQueryTimeout6() - EM find/update runTime" +
" msecs=" + runTime);
// Hack - Windows sometimes returns 1999 instead of 2000+
assertTrue("Should have taken 2+ secs, but was msecs=" +
runTime, runTime > 1900);
em.clear();
qt = em.find(QTimeout.class, new Integer(1));
assertEquals("Verify the entity was updated.",
qt.getStringField(), "updated");
} catch (Exception e) {
// setting a timeout property via PU or Map shouldn't cause a
// timeout exception
fail("Unexpected testQueryTimeout6() exception = " + e);
}