public final class DatabaseUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DatabaseUtils.DatabaseType |
| Modifier and Type | Field and Description |
|---|---|
static String |
TEST_TABLE |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeQuietly(Object closable) |
static void |
executeScript(Reader sqlScript) |
static void |
executeScript(org.springframework.core.io.Resource sqlScript) |
static void |
executeStatements(List<String> statements) |
static int |
executeUpdate(String query) |
static DatabaseUtils.DatabaseType |
getDatabaseType() |
static DataSource |
getDatasource() |
static org.hibernate.ScrollMode |
getFirstSupportedScrollMode(org.hibernate.ScrollMode fallback,
org.hibernate.ScrollMode... scrollModesToTest) |
static org.hibernate.SessionFactory |
getHibernateSessionFactory() |
static org.springframework.core.io.Resource[] |
getScripts(String basePath,
org.springframework.context.ApplicationContext applicationContext)
Get all SQL scripts located within a base directory, as a resources.
|
static void |
initializeDatabaseStructure(String varDir,
org.springframework.context.ApplicationContext applicationContext)
Create all the database structures like tables/indices/triggers.
|
static boolean |
isDatabaseStructureInitialized()
Check whether necessary database structures like tables/indices/triggers are present;
currently we simply check if the
TEST_TABLE table is present and assume everything else is present too if so. |
static void |
setDatasource(DataSource ds) |
public static final String TEST_TABLE
public static void closeQuietly(Object closable)
public static void executeScript(org.springframework.core.io.Resource sqlScript)
throws SQLException,
IOException
SQLExceptionIOExceptionpublic static void executeScript(Reader sqlScript) throws SQLException, IOException
SQLExceptionIOExceptionpublic static void executeStatements(List<String> statements) throws SQLException
SQLExceptionpublic static int executeUpdate(String query) throws SQLException
SQLExceptionpublic static DatabaseUtils.DatabaseType getDatabaseType()
public static DataSource getDatasource()
public static org.hibernate.ScrollMode getFirstSupportedScrollMode(org.hibernate.ScrollMode fallback,
org.hibernate.ScrollMode... scrollModesToTest)
public static boolean isDatabaseStructureInitialized()
TEST_TABLE table is present and assume everything else is present too if so.public static void initializeDatabaseStructure(String varDir, org.springframework.context.ApplicationContext applicationContext)
varDir - The "var" directory of the DX installationapplicationContext - The DX application contextpublic static org.springframework.core.io.Resource[] getScripts(String basePath, org.springframework.context.ApplicationContext applicationContext) throws IOException
basePath - The absolute path of the base directory to look for SQL script inapplicationContext - The DX application contextIOException - in case of an error when retrieving SQL scriptspublic static org.hibernate.SessionFactory getHibernateSessionFactory()
public static void setDatasource(DataSource ds)
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.