final Object entity2 = em2.find(entityClass, oid);
final long timeout = 1000;
try {
Map<String,Object> hint = new HashMap<String, Object>();
hint.put("javax.persistence.lock.timeout", timeout);
em2.lock(entity2, LockModeType.PESSIMISTIC_WRITE, hint);
fail("Expected " + PessimisticLockException.class.getName());
} catch (Throwable t) {
assertError(t, PessimisticLockException.class);
assertTrue(em2.getTransaction().isActive());
} finally {