use of javax.persistence.EntityManager in project che by eclipse.
the class JpaFactoryDao method doUpdate.
@Transactional
protected FactoryImpl doUpdate(FactoryImpl update) throws NotFoundException {
final EntityManager manager = managerProvider.get();
if (manager.find(FactoryImpl.class, update.getId()) == null) {
throw new NotFoundException(format("Could not update factory with id %s because it doesn't exist", update.getId()));
}
if (update.getWorkspace() != null) {
update.getWorkspace().getProjects().forEach(ProjectConfigImpl::prePersistAttributes);
}
FactoryImpl merged = manager.merge(update);
manager.flush();
return merged;
}
use of javax.persistence.EntityManager in project che by eclipse.
the class JpaFactoryDao method doRemove.
@Transactional
protected void doRemove(String id) {
final EntityManager manager = managerProvider.get();
final FactoryImpl factory = manager.find(FactoryImpl.class, id);
if (factory != null) {
manager.remove(factory);
manager.flush();
}
}
use of javax.persistence.EntityManager in project che by eclipse.
the class JpaPreferenceDao method doRemove.
@Transactional
protected void doRemove(String userId) {
final EntityManager manager = managerProvider.get();
final PreferenceEntity prefs = manager.find(PreferenceEntity.class, userId);
if (prefs != null) {
manager.remove(prefs);
manager.flush();
}
}
use of javax.persistence.EntityManager in project che by eclipse.
the class JpaProfileDao method doRemove.
@Transactional
protected void doRemove(String userId) {
final EntityManager manager = managerProvider.get();
final ProfileImpl profile = manager.find(ProfileImpl.class, userId);
if (profile != null) {
manager.remove(profile);
manager.flush();
}
}
use of javax.persistence.EntityManager in project che by eclipse.
the class JpaProfileDao method doUpdate.
@Transactional
protected void doUpdate(ProfileImpl profile) throws NotFoundException {
final EntityManager manager = managerProvider.get();
if (manager.find(ProfileImpl.class, profile.getUserId()) == null) {
throw new NotFoundException(format("Couldn't update profile, because profile for user with id '%s' doesn't exist", profile.getUserId()));
}
manager.merge(profile);
manager.flush();
}
Aggregations