Additional settings for JTA TX and Quarkus

This commit is contained in:
Martin Bartoš 2023-03-22 13:47:34 +01:00 committed by Václav Muzikář
parent 9719e1d210
commit fb855538fa
2 changed files with 2 additions and 2 deletions

View file

@ -314,6 +314,7 @@ class KeycloakProcessor {
defaultSchema.ifPresent(ds -> unitProperties.setProperty(AvailableSettings.DEFAULT_SCHEMA, ds));
unitProperties.setProperty(AvailableSettings.JAKARTA_TRANSACTION_TYPE, PersistenceUnitTransactionType.JTA.name());
descriptor.setTransactionType(PersistenceUnitTransactionType.JTA);
final Optional<String> lockTimeoutConfigValue = getOptionalValue("spi-map-storage-jpa-lock-timeout");
lockTimeoutConfigValue.ifPresent(v -> unitProperties.setProperty(AvailableSettings.JAKARTA_LOCK_TIMEOUT, v));

View file

@ -19,7 +19,6 @@ package org.keycloak.quarkus.runtime.transaction;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.transaction.TransactionManager;
import org.jboss.logging.Logger;
import org.keycloak.Config;
import org.keycloak.models.KeycloakSessionFactory;
@ -39,7 +38,7 @@ public class QuarkusJtaTransactionManagerLookup implements JtaTransactionManager
tm = CDI.current().select(TransactionManager.class).get();
logger.tracev("TransactionManager = {0}", tm);
if (tm == null) {
logger.debug("Could not locate JTA TransactionManager. JTA transactions not supported.");
throw new RuntimeException("You must provide JTA TransactionManager as the default transaction type is JTA");
}
}
}