diff --git a/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigService.java b/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigService.java index 64e2c80..ce59c2c 100644 --- a/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigService.java +++ b/account/src/main/java/de/muehlencord/shared/account/business/config/boundary/ConfigService.java @@ -14,6 +14,8 @@ import javax.ejb.Lock; import javax.ejb.LockType; import javax.ejb.Singleton; import javax.ejb.Startup; +import javax.ejb.TransactionAttribute; +import static javax.ejb.TransactionAttributeType.REQUIRES_NEW; import javax.inject.Inject; import javax.persistence.EntityManager; import javax.persistence.Query; @@ -84,6 +86,7 @@ public class ConfigService implements Serializable { @Transactional @Lock(LockType.WRITE) + @TransactionAttribute(REQUIRES_NEW) public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue) throws ConfigException { // get configValue as usual String configValue = getConfigValue(configKey); @@ -127,6 +130,7 @@ public class ConfigService implements Serializable { @Transactional @Lock(LockType.WRITE) + @TransactionAttribute(REQUIRES_NEW) public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue, Account account, boolean fallbackToSystem) throws ConfigException { String configValue = getConfigValue(configKey, account, fallbackToSystem); @@ -145,6 +149,7 @@ public class ConfigService implements Serializable { @Transactional @Lock(LockType.WRITE) + @TransactionAttribute(REQUIRES_NEW) public boolean updateConfigValue(String configKey, String configValue) throws ConfigException { Account account = getAccount("system"); return updateConfigValue(configKey, account, configValue); @@ -152,6 +157,7 @@ public class ConfigService implements Serializable { @Transactional @Lock(LockType.WRITE) + @TransactionAttribute(REQUIRES_NEW) public boolean updateConfigValue(String configKey, String accountName, String configValue) { Account account = getAccount(accountName); if (accountName == null) { @@ -166,6 +172,7 @@ public class ConfigService implements Serializable { @Transactional @Lock(LockType.WRITE) + @TransactionAttribute(REQUIRES_NEW) public boolean updateConfigValue(String configKey, Account account, String configValue) { if ((configKey == null) || (configKey.equals("")) || (configValue == null) || (configValue.equals(""))) { // null or empty key / values are not possible