try to fix "Illegal attempt to associate a ManagedEntity with two open persistence contexts"

This commit is contained in:
Athou
2024-08-17 16:22:46 +02:00
parent 2395a2670e
commit e38ca66c51
3 changed files with 12 additions and 4 deletions

View File

@@ -43,6 +43,14 @@ public abstract class GenericDAO<T extends AbstractModel> {
models.forEach(this::saveOrUpdate);
}
public void persist(T model) {
entityManager.persist(model);
}
public T merge(T model) {
return entityManager.merge(model);
}
public T findById(Long id) {
return entityManager.find(entityClass, id);
}