|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.confluence.upgrade.upgradetask.DataAccessUtils
public abstract class DataAccessUtils
Provides access to several underlying Hibernate and JDBC data access objects, which are commonly used in database-related upgrade tasks.
Method Summary | ||
---|---|---|
static java.util.Set<java.lang.String> |
filterToExistingTables(java.util.Set<java.lang.String> tableNames,
org.springframework.transaction.PlatformTransactionManager transactionManager,
net.sf.hibernate.SessionFactory sessionFactory)
Within a new transaction (for DB metadata retrieval), return the supplied Set of tables names filtered such that all the tables that don't exist are removed. |
|
static void |
flush(net.sf.hibernate.Session session)
Flushes the session. |
|
static void |
flushAndClear(net.sf.hibernate.Session session)
Flushes and clears the session. |
|
static java.sql.Connection |
getConnection(net.sf.hibernate.Session session)
Returns the JDBC connection for the session. |
|
static net.sf.hibernate.dialect.Dialect |
getDialect()
|
|
static net.sf.hibernate.dialect.Dialect |
getDialect(ConfluenceHibernateConfig hibernateConfig)
|
|
static org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate(net.sf.hibernate.Session session)
Returns a JDBC template for the provided Hibernate session. |
|
static org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate(net.sf.hibernate.SessionFactory sessionFactory)
Returns a JDBC template for the active Hibernate session. |
|
static java.lang.String |
getPrimaryKeyColumnName(org.springframework.transaction.PlatformTransactionManager transactionManager,
net.sf.hibernate.SessionFactory sessionFactory,
java.lang.String tableName)
|
|
static net.sf.hibernate.Session |
getSession(net.sf.hibernate.SessionFactory sessionFactory)
Returns the current session or creates one if one does not exist. |
|
static boolean |
isColumnPresent(java.lang.String tableName,
java.lang.String columnName,
org.springframework.transaction.PlatformTransactionManager transactionManager,
net.sf.hibernate.SessionFactory sessionFactory,
BootstrapManager bootstrapManager)
|
|
static boolean |
isTablePresent(java.lang.String tableName,
org.springframework.transaction.PlatformTransactionManager transactionManager,
net.sf.hibernate.SessionFactory sessionFactory)
Within a new transaction (for the database metadata lookup) check if the named table exists in the database. |
|
static
|
withNewConnection(org.springframework.transaction.PlatformTransactionManager transactionManager,
net.sf.hibernate.SessionFactory sessionFactory,
com.google.common.base.Function<java.sql.Connection,T> callback)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static net.sf.hibernate.Session getSession(net.sf.hibernate.SessionFactory sessionFactory)
SessionFactoryUtils.getSession(net.sf.hibernate.SessionFactory, boolean)
public static void flush(net.sf.hibernate.Session session) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
- if the connection cannot be retrievedpublic static void flushAndClear(net.sf.hibernate.Session session) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
- if the connection cannot be retrievedpublic static org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate(net.sf.hibernate.Session session)
public static org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate(net.sf.hibernate.SessionFactory sessionFactory)
getSession(SessionFactory)
,
getJdbcTemplate(Session)
public static java.sql.Connection getConnection(net.sf.hibernate.Session session) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
- if the connection cannot be retrievedpublic static net.sf.hibernate.dialect.Dialect getDialect() throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
public static net.sf.hibernate.dialect.Dialect getDialect(ConfluenceHibernateConfig hibernateConfig) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
public static java.util.Set<java.lang.String> filterToExistingTables(java.util.Set<java.lang.String> tableNames, org.springframework.transaction.PlatformTransactionManager transactionManager, net.sf.hibernate.SessionFactory sessionFactory)
tableNames
- transactionManager
-
public static boolean isTablePresent(java.lang.String tableName, org.springframework.transaction.PlatformTransactionManager transactionManager, net.sf.hibernate.SessionFactory sessionFactory)
tableName
- transactionManager
- sessionFactory
-
public static java.lang.String getPrimaryKeyColumnName(org.springframework.transaction.PlatformTransactionManager transactionManager, net.sf.hibernate.SessionFactory sessionFactory, java.lang.String tableName)
public static boolean isColumnPresent(java.lang.String tableName, java.lang.String columnName, org.springframework.transaction.PlatformTransactionManager transactionManager, net.sf.hibernate.SessionFactory sessionFactory, BootstrapManager bootstrapManager) throws com.atlassian.core.exception.InfrastructureException
com.atlassian.core.exception.InfrastructureException
public static <T> T withNewConnection(org.springframework.transaction.PlatformTransactionManager transactionManager, net.sf.hibernate.SessionFactory sessionFactory, com.google.common.base.Function<java.sql.Connection,T> callback)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |