made em configurable (required for unit testing)

This commit is contained in:
2020-01-13 00:52:25 +01:00
parent 6d9a87e15b
commit 799c7d52e3

View File

@ -56,6 +56,11 @@ public abstract class CommonAbstractController {
@ApplicationPU @ApplicationPU
protected EntityManager em; protected EntityManager em;
// required for unit testing
public void setEntityManager (EntityManager em) {
this.em = em;
}
@Lock(LockType.READ) @Lock(LockType.READ)
public <T extends Serializable> T find(Class<T> clazz, Object id) { public <T extends Serializable> T find(Class<T> clazz, Object id) {
return em.find(clazz, id); return em.find(clazz, id);