org.hibernate.cfg.Settings.getConnectionProvider()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中org.hibernate.cfg.Settings.getConnectionProvider()方法的一些代码示例,展示了Settings.getConnectionProvider()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getConnectionProvider()方法的具体详情如下:
包路径:org.hibernate.cfg.Settings
类名称:Settings
方法名:getConnectionProvider

Settings.getConnectionProvider介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate

public ConnectionProvider getConnectionProvider() {
  return settings.getConnectionProvider();
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public ConnectionProvider getConnectionProvider() {
  return settings.getConnectionProvider();
}

代码示例来源:origin: stackoverflow.com

Settings settings = ((SessionFactoryImpl) sessionFactory).getSettings();
if (settings != null) {
  Connection connection = settings.getConnectionProvider().getConnection();
  String dbURL  = connection.getMetaData().getURL();
  connection.close();
}

代码示例来源:origin: org.jbpm.jbpm3/jbpm-jpdl

public JbpmSchemaUpdate(Configuration cfg, Settings settings) throws HibernateException {
 this.configuration = cfg;
 dialect = settings.getDialect();
 connectionProvider = settings.getConnectionProvider();
 exceptions = new ArrayList();
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public SchemaUpdate(Configuration cfg, Settings settings) throws HibernateException {
  this.configuration = cfg;
  dialect = settings.getDialect();
  connectionHelper = new SuppliedConnectionProviderConnectionHelper(
      settings.getConnectionProvider()
  );
  exceptions = new ArrayList();
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public SchemaValidator(Configuration cfg, Settings settings) throws HibernateException {
  this.configuration = cfg;
  dialect = settings.getDialect();
  connectionHelper = new SuppliedConnectionProviderConnectionHelper(
      settings.getConnectionProvider()
  );
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

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;
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

/**
 * 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();
}

代码示例来源:origin: hibernate/hibernate

settings.getConnectionProvider().close();

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

settings.getConnectionProvider().close();

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

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;
}

相关文章

Settings类方法