fixed borken update (entity, updatedBy) method

This commit is contained in:
2019-08-14 12:02:51 +02:00
parent 08a0adcc6f
commit 0f98586434

View File

@ -137,16 +137,15 @@ public abstract class CommonAbstractController {
@Transactional
@Lock(LockType.WRITE)
public <T extends Serializable> T update(T entity, String updatedBy) throws ControllerException {
T currentEntity = executeUpdate(entity, updatedBy);
T newEntity = EntityUtil.cloneToNewEntity(currentEntity);
T currentEntity = executeUpdate(entity, updatedBy);
if (EndDateable.class.isAssignableFrom(entity.getClass())) {
T newEntity = EntityUtil.cloneToNewEntity(currentEntity);
em.merge(currentEntity);
return create(newEntity, updatedBy);
} else {
// if it is not enddatable, just update it (already done above)
// and save it
return em.merge(entity);
return em.merge(currentEntity);
}
}