Commit 60c5d336 authored by michael.simon's avatar michael.simon
Browse files

Change identity to user to no cascading and do it manually

This is really slow with cascading sometimes
parent 1dddc065
......@@ -12,7 +12,6 @@ package edu.kit.scc.webreg.entity.identity;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
......@@ -35,8 +34,7 @@ public class IdentityEntity extends AbstractBaseEntity {
@Column(name="twofa_user_name", length=512)
private String twoFaUserName;
@OneToMany(targetEntity=UserEntity.class, mappedBy = "identity",
cascade = CascadeType.ALL)
@OneToMany(targetEntity=UserEntity.class, mappedBy = "identity")
private Set<UserEntity> users;
@OneToMany(targetEntity=IdentityUserPreferenceEntity.class, mappedBy = "identity")
......
......@@ -91,6 +91,8 @@ public class IdentityServiceImpl extends BaseServiceImpl<IdentityEntity, Long> i
id.setTwoFaUserName(user.getEppn());
else
id.setTwoFaUserName(UUID.randomUUID().toString());
logger.info("Add missing 2fa userId {} and 2fa username {}", id.getTwoFaUserId(), id.getTwoFaUserName());
}
}
else {
......
......@@ -86,7 +86,9 @@ public class UserDeleteServiceImpl implements UserDeleteService {
logger.info("Delete all personal user data for identity {}", identity.getId());
identity = identityDao.merge(identity);
for (UserEntity user : identity.getUsers()) {
List<UserEntity> userList = userDao.findByIdentity(identity);
for (UserEntity user : userList) {
logger.info("Delete all personal user data for user {}", user.getId());
UserDeleteAuditor auditor = new UserDeleteAuditor(auditEntryDao, auditDetailDao, appConfig);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment