use of org.eclipse.persistence.internal.sessions.UnitOfWorkImpl in project eclipselink by eclipse-ee4j.
the class EntityManagerImpl method mergeInternal.
/**
* Merge the state of the given entity into the current persistence context,
* using the unqualified class name as the entity name.
*
* @return the instance that the state was merged to
* @throws IllegalArgumentException
* if given Object is not an entity or is a removed entity
*/
protected Object mergeInternal(Object entity) {
if (entity == null) {
throw new IllegalArgumentException(ExceptionLocalization.buildMessage("not_an_entity", new Object[] { null }));
}
Object merged = null;
UnitOfWorkImpl context = getActivePersistenceContext(checkForTransaction(false));
try {
merged = context.mergeCloneWithReferences(entity, MergeManager.CASCADE_BY_MAPPING, true);
} catch (org.eclipse.persistence.exceptions.OptimisticLockException ole) {
throw new jakarta.persistence.OptimisticLockException(ole);
}
return merged;
}
use of org.eclipse.persistence.internal.sessions.UnitOfWorkImpl in project eclipselink by eclipse-ee4j.
the class BeanValidationListener method aboutToUpdate.
@Override
public void aboutToUpdate(DescriptorEvent event) {
Object source = event.getSource();
UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl) event.getSession();
// Do not perform preUpdate validation for such objects as preRemove would have already been called.
if (!unitOfWork.isObjectDeleted(source)) {
validateOnCallbackEvent(event, "preUpdate", groupPreUpdate);
}
}
Aggregations