Maintain only one row in the TmchCrl table at all times (#869)

* Maintain only one row in the TmchCrl table at all times
This commit is contained in:
gbrodman
2020-11-10 17:09:26 -05:00
committed by GitHub
parent f1eb1a8fe7
commit 88f4f36678
2 changed files with 27 additions and 1 deletions
@@ -77,7 +77,16 @@ public final class TmchCrl extends CrossTldSingleton implements DatastoreEntity,
tmchCrl.crl = checkNotNull(crl, "crl");
tmchCrl.url = checkNotNull(url, "url");
ofyTm().transactNew(() -> ofyTm().putWithoutBackup(tmchCrl));
jpaTm().transactNew(() -> jpaTm().putWithoutBackup(tmchCrl));
jpaTm()
.transactNew(
() -> {
// Delete the old one and insert the new one
jpaTm()
.getEntityManager()
.createQuery("DELETE FROM TmchCrl")
.executeUpdate();
jpaTm().putWithoutBackup(tmchCrl);
});
});
}