org.springframework.jdbc.core.JdbcTemplate.setLazyInit()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(186)

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

JdbcTemplate.setLazyInit介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Construct a new JdbcTemplate, given a DataSource to obtain connections from.
 * <p>Note: Depending on the "lazyInit" flag, initialization of the exception translator
 * will be triggered.
 * @param dataSource the JDBC DataSource to obtain connections from
 * @param lazyInit whether to lazily initialize the SQLExceptionTranslator
 */
public JdbcTemplate(DataSource dataSource, boolean lazyInit) {
  setDataSource(dataSource);
  setLazyInit(lazyInit);
  afterPropertiesSet();
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * If beanProperty is true, initialize via exception translator bean property;
 * if false, use afterPropertiesSet().
 */
private void doTestCouldNotGetConnectionInOperationWithExceptionTranslatorInitialized(boolean beanProperty)
    throws SQLException {
  SQLException sqlException = new SQLException("foo", "07xxx");
  this.dataSource = mock(DataSource.class);
  given(this.dataSource.getConnection()).willThrow(sqlException);
  this.template = new JdbcTemplate();
  this.template.setDataSource(this.dataSource);
  this.template.setLazyInit(false);
  if (beanProperty) {
    // This will get a connection.
    this.template.setExceptionTranslator(new SQLErrorCodeSQLExceptionTranslator(this.dataSource));
  }
  else {
    // This will cause creation of default SQL translator.
    this.template.afterPropertiesSet();
  }
  RowCountCallbackHandler rcch = new RowCountCallbackHandler();
  this.thrown.expect(CannotGetJdbcConnectionException.class);
  this.thrown.expect(exceptionCause(sameInstance(sqlException)));
  this.template.query("SELECT ID, FORENAME FROM CUSTMR WHERE ID < 3", rcch);
}

代码示例来源:origin: io.bufferslayer/buffer-spring-jdbc

public void setLazyInit(boolean lazyInit) {
 delegate.setLazyInit(lazyInit);
}

代码示例来源:origin: io.bufferslayer/bufferslayer-spring-jdbc

public void setLazyInit(boolean lazyInit) {
 delegate.setLazyInit(lazyInit);
}

代码示例来源:origin: org.springframework/org.springframework.jdbc

/**
 * Construct a new JdbcTemplate, given a DataSource to obtain connections from.
 * <p>Note: Depending on the "lazyInit" flag, initialization of the exception translator
 * will be triggered.
 * @param dataSource the JDBC DataSource to obtain connections from
 * @param lazyInit whether to lazily initialize the SQLExceptionTranslator
 */
public JdbcTemplate(DataSource dataSource, boolean lazyInit) {
  setDataSource(dataSource);
  setLazyInit(lazyInit);
  afterPropertiesSet();
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Construct a new JdbcTemplate, given a DataSource to obtain connections from.
 * <p>Note: Depending on the "lazyInit" flag, initialization of the exception translator
 * will be triggered.
 * @param dataSource the JDBC DataSource to obtain connections from
 * @param lazyInit whether to lazily initialize the SQLExceptionTranslator
 */
public JdbcTemplate(DataSource dataSource, boolean lazyInit) {
  setDataSource(dataSource);
  setLazyInit(lazyInit);
  afterPropertiesSet();
}

代码示例来源:origin: cloudatee/vesta-id-generator

jdbcTemplate.setLazyInit(false);
jdbcTemplate.setDataSource(comboPooledDataSource);

相关文章