/** * 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); }
/** * 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); }
/** * Specify the JDBC DataSource that the JPA persistence provider is supposed to use for accessing the database. * * <p> * This is an alternative to keeping the JDBC configuration in {@code persistence.xml}, passing in a Spring-managed * DataSource instead. * </p> * * <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> * * @param jtaDataSource the JTA-enabled DataSource to use for this EntityManagerFactory * * @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource() * @see {@link DefaultPersistenceUnitManager#setDefaultJtaDataSource(javax.sql.DataSource)} */ public void setJtaDataSource(DataSource jtaDataSource) { persistenceUnitManager.setDefaultJtaDataSource(jtaDataSource); }
/** * 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); }