本文整理汇总了Java中org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.setDefaultDataSource方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultPersistenceUnitManager.setDefaultDataSource方法的具体用法?Java DefaultPersistenceUnitManager.setDefaultDataSource怎么用?Java DefaultPersistenceUnitManager.setDefaultDataSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
的用法示例。
在下文中一共展示了DefaultPersistenceUnitManager.setDefaultDataSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: persistenceUnitManager
import org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager; //导入方法依赖的package包/类
/**
* @return Introduce custom persistence unit manager so that we can use the orm.xml file to rename the table
* mapping for Student.java and verify that we pick up the renamed mapping via ProviderAccess.
*/
@Bean
public PersistenceUnitManager persistenceUnitManager(DataSource dataSource) {
DefaultPersistenceUnitManager manager = new DefaultPersistenceUnitManager();
manager.setPersistenceXmlLocation("classpath:META-INF/pedal-test-persistence.xml");
manager.setDefaultDataSource(dataSource);
return manager;
}
示例2: corePersistenceUnitManager
import org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager; //导入方法依赖的package包/类
@Bean(name="corePersistenceUnitManager")
@Primary
public PersistenceUnitManager corePersistenceUnitManager(DatabaseSelector dataSource) {
DefaultPersistenceUnitManager persistenceUnitManager = new DefaultPersistenceUnitManager();
persistenceUnitManager.setDefaultDataSource(dataSource);
persistenceUnitManager.setPackagesToScan("edu.cmu.cs.lti.discoursedb.core.model");
persistenceUnitManager.setDefaultPersistenceUnitName("corePersistenceUnitManager");
return persistenceUnitManager;
}
示例3: systemPersistenceUnitManager
import org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager; //导入方法依赖的package包/类
@Bean(name="systemPersistenceUnitManager")
public PersistenceUnitManager systemPersistenceUnitManager() {
DefaultPersistenceUnitManager persistenceUnitManager = new DefaultPersistenceUnitManager();
persistenceUnitManager.setDefaultDataSource(this.systemDataSource());
persistenceUnitManager.setPackagesToScan("edu.cmu.cs.lti.discoursedb.system.model");
persistenceUnitManager.setDefaultPersistenceUnitName("systemPersistenceUnitManager");
return persistenceUnitManager;
}
示例4: preparePersistentUnitManager
import org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager; //导入方法依赖的package包/类
private PersistenceUnitManager preparePersistentUnitManager(Config config, String prefix, DataSource datasource) {
DefaultPersistenceUnitManager persistenceUnitManager = new DefaultPersistenceUnitManager();
persistenceUnitManager.setDefaultDataSource(datasource);
persistenceUnitManager.setPersistenceXmlLocations(new String[] {determineConfigProperty(config, prefix, "PersistenceXmlLocation", "META-INF/persistence.xml")});
persistenceUnitManager.setDefaultPersistenceUnitRootLocation(determineConfigProperty(config, prefix, "PersistenceUnitRootLocation", "classpath:"));
RicePersistenceUnitPostProcessor postProcessor = new RicePersistenceUnitPostProcessor();
postProcessor.setJtaDataSource(datasource);
persistenceUnitManager.setPersistenceUnitPostProcessors(new RicePersistenceUnitPostProcessor[] { postProcessor });
persistenceUnitManager.afterPropertiesSet();
return persistenceUnitManager;
}