use of org.keycloak.models.map.storage.jpa.updater.MapJpaUpdaterProvider in project keycloak by keycloak.
the class JpaMapStorageProviderFactory method validateAndUpdateSchema.
public void validateAndUpdateSchema(KeycloakSession session, Class<?> modelType) {
if (this.validatedModels.add(modelType)) {
Connection connection = getConnection();
try {
if (logger.isDebugEnabled())
printOperationalInfo(connection);
MapJpaUpdaterProvider updater = session.getProvider(MapJpaUpdaterProvider.class);
MapJpaUpdaterProvider.Status status = updater.validate(modelType, connection, config.get("schema"));
if (!status.equals(VALID)) {
update(modelType, connection, session);
}
} finally {
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
logger.warn("Can't close connection", e);
}
}
}
}
}
Aggregations