Passing from glassfish3 to payara5 one piece of code stop waorking. Our code save a date to a set of record and the select those updated record. In glassfish3 work seamlessly, in payara5 the select return no record (seems like it does work in another transaction). If the result is different we throw an exception, so the data is never saved. The transaction scope is READ_COMMITTED
try {
String whereClause = " where "
+ "em.mailboxToBeUsed =:mailbox "
+ "and em.lastSendResult is null "
+ "and (em.errorsNumber is null or em.errorsNumber<4) ";
Query updateQuery = em.createQuery("update EmailTobeSended em "
+ "set em.trysendsince=:dat " + whereClause);
updateQuery.setParameter("mailbox", mb);
updateQuery.setParameter("dat", key);
int modificate = updateQuery.executeUpdate();
em.flush();
TypedQuery<EmailTobeSended> emlocksel = em.createQuery(
"select em from EmailTobeSended em WHERE em.mailboxToBeUsed =:mailbox AND "
+ "em.trysendsince=:dat "
+ " order by em.emailId ", EmailTobeSended.class);
emlocksel.setParameter("mailbox", mb);
emlocksel.setParameter("dat", key);
res = emlocksel.getResultList();
if (modificate != res.size()) {
throw new java.lang.AssertionError("Lock error on select emailtobesended");
}
} catch (Exception ex) {
gotError = true;
res = null;
}
On glassfish3, after flushing, the second query find out the record updated. On payara5 no result
EDIT
we use eclipselink