Package org.keycloak.connections.jpa.updater

Examples of org.keycloak.connections.jpa.updater.JpaUpdaterProvider


                    }

                    if (databaseSchema != null) {
                        logger.trace("Updating database");

                        JpaUpdaterProvider updater = session.getProvider(JpaUpdaterProvider.class);
                        connection = getConnection();

                        if (databaseSchema.equals("update")) {
                            String currentVersion = null;
                            try {
                                ResultSet resultSet = connection.createStatement().executeQuery(updater.getCurrentVersionSql());
                                if (resultSet.next()) {
                                    currentVersion = resultSet.getString(1);
                                }
                            } catch (SQLException e) {
                            }

                            if (currentVersion == null || !JpaUpdaterProvider.LAST_VERSION.equals(currentVersion)) {
                                updater.update(connection);
                            } else {
                                logger.debug("Database is up to date");
                            }
                        } else if (databaseSchema.equals("validate")) {
                            updater.validate(connection);
                        } else {
                            throw new RuntimeException("Invalid value for databaseSchema: " + databaseSchema);
                        }

                        logger.trace("Database update completed");
View Full Code Here

TOP

Related Classes of org.keycloak.connections.jpa.updater.JpaUpdaterProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.