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

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

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

Settings.getMultiTenancyStrategy介绍

暂无

代码示例

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

@Override
public Connection obtainConnection() throws SQLException {
  return !settings.getMultiTenancyStrategy().requiresMultiTenantConnectionProvider()
      ? serviceRegistry.getService( ConnectionProvider.class ).getConnection()
      : serviceRegistry.getService( MultiTenantConnectionProvider.class ).getAnyConnection();
}

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

@Override
public void releaseConnection(Connection connection) throws SQLException {
  if ( !settings.getMultiTenancyStrategy().requiresMultiTenantConnectionProvider() ) {
    serviceRegistry.getService( ConnectionProvider.class ).closeConnection( connection );
  }
  else {
    serviceRegistry.getService( MultiTenantConnectionProvider.class ).releaseAnyConnection( connection );
  }
}

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

@Override
public JdbcConnectionAccess getJdbcConnectionAccess() {
  // See class-level JavaDocs for a discussion of the concurrent-access safety of this method
  if ( jdbcConnectionAccess == null ) {
    if ( !factory.getSettings().getMultiTenancyStrategy().requiresMultiTenantConnectionProvider() ) {
      jdbcConnectionAccess = new NonContextualJdbcConnectionAccess(
          getEventListenerManager(),
          factory.getServiceRegistry().getService( ConnectionProvider.class )
      );
    }
    else {
      jdbcConnectionAccess = new ContextualJdbcConnectionAccess(
          getTenantIdentifier(),
          getEventListenerManager(),
          factory.getServiceRegistry().getService( MultiTenantConnectionProvider.class )
      );
    }
  }
  return jdbcConnectionAccess;
}

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

if ( MultiTenancyStrategy.NONE == factory.getSettings().getMultiTenancyStrategy() ) {
  if ( tenantIdentifier != null ) {
    throw new HibernateException( "SessionFactory was not configured for multi-tenancy" );

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

protected AbstractSessionImpl(SessionFactoryImpl factory, String tenantIdentifier) {
  this.factory = factory;
  this.tenantIdentifier = tenantIdentifier;
  if ( MultiTenancyStrategy.NONE == factory.getSettings().getMultiTenancyStrategy() ) {
    if ( tenantIdentifier != null ) {
      throw new HibernateException( "SessionFactory was not configured for multi-tenancy" );
    }
  }
  else {
    if ( tenantIdentifier == null ) {
      throw new HibernateException( "SessionFactory configured for multi-tenancy, but no tenant identifier specified" );
    }
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

protected AbstractSessionImpl(SessionFactoryImpl factory, String tenantIdentifier) {
  this.factory = factory;
  this.tenantIdentifier = tenantIdentifier;
  if ( MultiTenancyStrategy.NONE == factory.getSettings().getMultiTenancyStrategy() ) {
    if ( tenantIdentifier != null ) {
      throw new HibernateException( "SessionFactory was not configured for multi-tenancy" );
    }
  }
  else {
    if ( tenantIdentifier == null ) {
      throw new HibernateException( "SessionFactory configured for multi-tenancy, but no tenant identifier specified" );
    }
  }
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

@Override
public Connection obtainConnection() throws SQLException {
  return !settings.getMultiTenancyStrategy().requiresMultiTenantConnectionProvider()
      ? serviceRegistry.getService( ConnectionProvider.class ).getConnection()
      : serviceRegistry.getService( MultiTenantConnectionProvider.class ).getAnyConnection();
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

@Override
public void releaseConnection(Connection connection) throws SQLException {
  if ( !settings.getMultiTenancyStrategy().requiresMultiTenantConnectionProvider() ) {
    serviceRegistry.getService( ConnectionProvider.class ).closeConnection( connection );
  }
  else {
    serviceRegistry.getService( MultiTenantConnectionProvider.class ).releaseAnyConnection( connection );
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

@Override
public JdbcConnectionAccess getJdbcConnectionAccess() {
  if ( jdbcConnectionAccess == null ) {
    if ( MultiTenancyStrategy.NONE == factory.getSettings().getMultiTenancyStrategy() ) {
      jdbcConnectionAccess = new NonContextualJdbcConnectionAccess(
          factory.getServiceRegistry().getService( ConnectionProvider.class )
      );
    }
    else {
      jdbcConnectionAccess = new ContextualJdbcConnectionAccess(
          factory.getServiceRegistry().getService( MultiTenantConnectionProvider.class )
      );
    }
  }
  return jdbcConnectionAccess;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

@Override
public JdbcConnectionAccess getJdbcConnectionAccess() {
  if ( jdbcConnectionAccess == null ) {
    if ( MultiTenancyStrategy.NONE == factory.getSettings().getMultiTenancyStrategy() ) {
      jdbcConnectionAccess = new NonContextualJdbcConnectionAccess(
          factory.getServiceRegistry().getService( ConnectionProvider.class )
      );
    }
    else {
      jdbcConnectionAccess = new ContextualJdbcConnectionAccess(
          factory.getServiceRegistry().getService( MultiTenantConnectionProvider.class )
      );
    }
  }
  return jdbcConnectionAccess;
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

@Override
public JdbcConnectionAccess getJdbcConnectionAccess() {
  // See class-level JavaDocs for a discussion of the concurrent-access safety of this method
  if ( jdbcConnectionAccess == null ) {
    if ( !factory.getSettings().getMultiTenancyStrategy().requiresMultiTenantConnectionProvider() ) {
      jdbcConnectionAccess = new NonContextualJdbcConnectionAccess(
          getEventListenerManager(),
          factory.getServiceRegistry().getService( ConnectionProvider.class )
      );
    }
    else {
      jdbcConnectionAccess = new ContextualJdbcConnectionAccess(
          getTenantIdentifier(),
          getEventListenerManager(),
          factory.getServiceRegistry().getService( MultiTenantConnectionProvider.class )
      );
    }
  }
  return jdbcConnectionAccess;
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

if ( MultiTenancyStrategy.NONE == factory.getSettings().getMultiTenancyStrategy() ) {
  if ( tenantIdentifier != null ) {
    throw new HibernateException( "SessionFactory was not configured for multi-tenancy" );

相关文章

Settings类方法