public ConnectionProvider getConnectionProvider() { return settings.getConnectionProvider(); }
public ConnectionProvider getConnectionProvider() { return settings.getConnectionProvider(); }
Settings settings = ((SessionFactoryImpl) sessionFactory).getSettings(); if (settings != null) { Connection connection = settings.getConnectionProvider().getConnection(); String dbURL = connection.getMetaData().getURL(); connection.close(); }
public JbpmSchemaUpdate(Configuration cfg, Settings settings) throws HibernateException { this.configuration = cfg; dialect = settings.getDialect(); connectionProvider = settings.getConnectionProvider(); exceptions = new ArrayList(); }
public SchemaUpdate(Configuration cfg, Settings settings) throws HibernateException { this.configuration = cfg; dialect = settings.getDialect(); connectionHelper = new SuppliedConnectionProviderConnectionHelper( settings.getConnectionProvider() ); exceptions = new ArrayList(); }
public SchemaValidator(Configuration cfg, Settings settings) throws HibernateException { this.configuration = cfg; dialect = settings.getDialect(); connectionHelper = new SuppliedConnectionProviderConnectionHelper( settings.getConnectionProvider() ); }
private SessionFactory injectInSessionFactory(Configuration config) throws XWikiException { SessionFactoryImpl sfactory = (SessionFactoryImpl) config.buildSessionFactory(); Settings settings = sfactory.getSettings(); ConnectionProvider provider = ((SessionFactoryImpl) getSessionFactory()).getSettings().getConnectionProvider(); Field field = null; try { field = settings.getClass().getDeclaredField("connectionProvider"); field.setAccessible(true); field.set(settings, provider); } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_MAPPING_INJECTION_FAILED, "Mapping injection failed", e); } return sfactory; }
/** * Create a schema exporter for the given Configuration * and given settings */ public SchemaExport(Configuration cfg, Settings settings) throws HibernateException { dialect = settings.getDialect(); connectionHelper = new SuppliedConnectionProviderConnectionHelper( settings.getConnectionProvider() ); dropSQL = cfg.generateDropSchemaScript( dialect ); createSQL = cfg.generateSchemaCreationScript( dialect ); format = settings.isFormatSqlEnabled(); }
settings.getConnectionProvider().close();
settings.getConnectionProvider().close();
private SessionFactory injectCustomMappingsInSessionFactory(XWikiDocument doc, XWikiContext context) throws XWikiException { // If we haven't turned of dynamic custom mappings we should not inject them if (context.getWiki().hasDynamicCustomMappings() == false) { return getSessionFactory(); } boolean result = injectCustomMappings(doc, context); if (result == false) { return getSessionFactory(); } Configuration config = getConfiguration(); SessionFactoryImpl sfactory = (SessionFactoryImpl) config.buildSessionFactory(); Settings settings = sfactory.getSettings(); ConnectionProvider provider = ((SessionFactoryImpl) getSessionFactory()).getSettings().getConnectionProvider(); Field field = null; try { field = settings.getClass().getDeclaredField("connectionProvider"); field.setAccessible(true); field.set(settings, provider); } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_MAPPING_INJECTION_FAILED, "Mapping injection failed", e); } return sfactory; }