org.springframework.jdbc.datasource.lookup.SingleDataSourceLookup Java Examples

The following examples show how to use org.springframework.jdbc.datasource.lookup.SingleDataSourceLookup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalContainerEntityManagerFactoryBean.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Specify the JDBC DataSource that the JPA persistence provider is supposed
 * to use for accessing the database. This is an alternative to keeping the
 * JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
 * DataSource instead.
 * <p>In JPA speak, a DataSource passed in here will be used as "nonJtaDataSource"
 * on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
 * overriding data source configuration in {@code persistence.xml} (if any).
 * Note that this variant typically works for JTA transaction management as well;
 * if it does not, consider using the explicit {@link #setJtaDataSource} instead.
 * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
 * @see javax.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
 * @see #setPersistenceUnitManager
 */
public void setDataSource(DataSource dataSource) {
	this.internalPersistenceUnitManager.setDataSourceLookup(new SingleDataSourceLookup(dataSource));
	this.internalPersistenceUnitManager.setDefaultDataSource(dataSource);
}
 
Example #2
Source File: LocalContainerEntityManagerFactoryBean.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Specify the JDBC DataSource that the JPA persistence provider is supposed
 * to use for accessing the database. This is an alternative to keeping the
 * JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
 * DataSource instead.
 * <p>In JPA speak, a DataSource passed in here will be used as "jtaDataSource"
 * on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
 * overriding data source configuration in {@code persistence.xml} (if any).
 * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
 * @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
 * @see #setPersistenceUnitManager
 */
public void setJtaDataSource(DataSource jtaDataSource) {
	this.internalPersistenceUnitManager.setDataSourceLookup(new SingleDataSourceLookup(jtaDataSource));
	this.internalPersistenceUnitManager.setDefaultJtaDataSource(jtaDataSource);
}
 
Example #3
Source File: LocalContainerEntityManagerFactoryBean.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Specify the JDBC DataSource that the JPA persistence provider is supposed
 * to use for accessing the database. This is an alternative to keeping the
 * JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
 * DataSource instead.
 * <p>In JPA speak, a DataSource passed in here will be used as "nonJtaDataSource"
 * on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
 * overriding data source configuration in {@code persistence.xml} (if any).
 * Note that this variant typically works for JTA transaction management as well;
 * if it does not, consider using the explicit {@link #setJtaDataSource} instead.
 * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
 * @see javax.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
 * @see #setPersistenceUnitManager
 */
public void setDataSource(DataSource dataSource) {
	this.internalPersistenceUnitManager.setDataSourceLookup(new SingleDataSourceLookup(dataSource));
	this.internalPersistenceUnitManager.setDefaultDataSource(dataSource);
}
 
Example #4
Source File: LocalContainerEntityManagerFactoryBean.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Specify the JDBC DataSource that the JPA persistence provider is supposed
 * to use for accessing the database. This is an alternative to keeping the
 * JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
 * DataSource instead.
 * <p>In JPA speak, a DataSource passed in here will be used as "jtaDataSource"
 * on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
 * overriding data source configuration in {@code persistence.xml} (if any).
 * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
 * @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
 * @see #setPersistenceUnitManager
 */
public void setJtaDataSource(DataSource jtaDataSource) {
	this.internalPersistenceUnitManager.setDataSourceLookup(new SingleDataSourceLookup(jtaDataSource));
	this.internalPersistenceUnitManager.setDefaultJtaDataSource(jtaDataSource);
}
 
Example #5
Source File: LocalContainerEntityManagerFactoryBean.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Specify the JDBC DataSource that the JPA persistence provider is supposed
 * to use for accessing the database. This is an alternative to keeping the
 * JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
 * DataSource instead.
 * <p>In JPA speak, a DataSource passed in here will be used as "nonJtaDataSource"
 * on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
 * overriding data source configuration in {@code persistence.xml} (if any).
 * Note that this variant typically works for JTA transaction management as well;
 * if it does not, consider using the explicit {@link #setJtaDataSource} instead.
 * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
 * @see javax.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
 * @see #setPersistenceUnitManager
 */
public void setDataSource(DataSource dataSource) {
	this.internalPersistenceUnitManager.setDataSourceLookup(new SingleDataSourceLookup(dataSource));
	this.internalPersistenceUnitManager.setDefaultDataSource(dataSource);
}
 
Example #6
Source File: LocalContainerEntityManagerFactoryBean.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Specify the JDBC DataSource that the JPA persistence provider is supposed
 * to use for accessing the database. This is an alternative to keeping the
 * JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
 * DataSource instead.
 * <p>In JPA speak, a DataSource passed in here will be used as "jtaDataSource"
 * on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
 * overriding data source configuration in {@code persistence.xml} (if any).
 * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
 * @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
 * @see #setPersistenceUnitManager
 */
public void setJtaDataSource(DataSource jtaDataSource) {
	this.internalPersistenceUnitManager.setDataSourceLookup(new SingleDataSourceLookup(jtaDataSource));
	this.internalPersistenceUnitManager.setDefaultJtaDataSource(jtaDataSource);
}
 
Example #7
Source File: LocalContainerEntityManagerFactoryBean.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Specify the JDBC DataSource that the JPA persistence provider is supposed
 * to use for accessing the database. This is an alternative to keeping the
 * JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
 * DataSource instead.
 * <p>In JPA speak, a DataSource passed in here will be used as "nonJtaDataSource"
 * on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
 * overriding data source configuration in {@code persistence.xml} (if any).
 * Note that this variant typically works for JTA transaction management as well;
 * if it does not, consider using the explicit {@link #setJtaDataSource} instead.
 * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
 * @see javax.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
 * @see #setPersistenceUnitManager
 */
public void setDataSource(DataSource dataSource) {
	this.internalPersistenceUnitManager.setDataSourceLookup(new SingleDataSourceLookup(dataSource));
	this.internalPersistenceUnitManager.setDefaultDataSource(dataSource);
}
 
Example #8
Source File: LocalContainerEntityManagerFactoryBean.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Specify the JDBC DataSource that the JPA persistence provider is supposed
 * to use for accessing the database. This is an alternative to keeping the
 * JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
 * DataSource instead.
 * <p>In JPA speak, a DataSource passed in here will be used as "jtaDataSource"
 * on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
 * overriding data source configuration in {@code persistence.xml} (if any).
 * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
 * @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
 * @see #setPersistenceUnitManager
 */
public void setJtaDataSource(DataSource jtaDataSource) {
	this.internalPersistenceUnitManager.setDataSourceLookup(new SingleDataSourceLookup(jtaDataSource));
	this.internalPersistenceUnitManager.setDefaultJtaDataSource(jtaDataSource);
}