本文整理汇总了Java中org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager类的典型用法代码示例。如果您正苦于以下问题:Java PersistenceUnitManager类的具体用法?Java PersistenceUnitManager怎么用?Java PersistenceUnitManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PersistenceUnitManager类属于org.springframework.orm.jpa.persistenceunit包,在下文中一共展示了PersistenceUnitManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: entityManagerFactoryBuilder
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public EntityManagerFactoryBuilder entityManagerFactoryBuilder(
JpaVendorAdapter jpaVendorAdapter,
ObjectProvider<PersistenceUnitManager> persistenceUnitManagerProvider) {
EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(
jpaVendorAdapter, this.properties.getProperties(),
persistenceUnitManagerProvider.getIfAvailable());
builder.setCallback(getVendorCallback());
return builder;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:JpaBaseConfiguration.java
示例2: persistenceUnitManager
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的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;
}
示例3: customPersistenceUnitManager
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
@Test
public void customPersistenceUnitManager() throws Exception {
setupTestConfiguration(TestConfigurationWithCustomPersistenceUnitManager.class);
this.context.refresh();
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = this.context
.getBean(LocalContainerEntityManagerFactoryBean.class);
Field field = LocalContainerEntityManagerFactoryBean.class
.getDeclaredField("persistenceUnitManager");
field.setAccessible(true);
assertThat(field.get(entityManagerFactoryBean))
.isEqualTo(this.context.getBean(PersistenceUnitManager.class));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:AbstractJpaAutoConfigurationTests.java
示例4: PersistenceUnitContext
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
/**
* Package private so that only PersistenceProperties class can initialize this one.
*/
public PersistenceUnitContext(final PersistenceUnitManager persistenceUnitManager,
final PersistenceUnitContextManager persistenceUnitContextManager, final String persistenceUnitName) {
this.persistenceUnitManager = persistenceUnitManager;
this.persistenceUnitContextManager = persistenceUnitContextManager;
this.systemProperties = new SystemProperties(getClass());
this.persistenceUnitName = persistenceUnitName;
}
示例5: corePersistenceUnitManager
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的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;
}
示例6: systemPersistenceUnitManager
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的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;
}
示例7: customPersistenceUnitManager
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
@Test
public void customPersistenceUnitManager() throws Exception {
setupTestConfiguration(TestConfigurationWithCustomPersistenceUnitManager.class);
this.context.refresh();
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = this.context
.getBean(LocalContainerEntityManagerFactoryBean.class);
Field field = LocalContainerEntityManagerFactoryBean.class
.getDeclaredField("persistenceUnitManager");
field.setAccessible(true);
assertThat(field.get(entityManagerFactoryBean),
equalTo((Object) this.context.getBean(PersistenceUnitManager.class)));
}
示例8: preparePersistentUnitManager
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的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;
}
示例9: PersistenceUnitContextManager
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
public PersistenceUnitContextManager(final PersistenceUnitManager persistenceUnitManager,
final IDialectSpecificDelegate[] dialectSpecificDelegates) {
Assertions.assertThat(persistenceUnitManager).isNotNull();
this.persistenceUnitManager = persistenceUnitManager;
associateDelegates(dialectSpecificDelegates);
}
示例10: Delegate
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
Delegate(JpaVendorAdapter jpaVendorAdapter, Map<String, ?> jpaProperties,
PersistenceUnitManager persistenceUnitManager) {
super(jpaVendorAdapter, jpaProperties, persistenceUnitManager);
}
示例11: determinePersistenceUnitInfo
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
/**
* Determine the PersistenceUnitInfo to use for the EntityManagerFactory
* created by this bean.
* <p>The default implementation reads in all persistence unit infos from
* {@code persistence.xml}, as defined in the JPA specification.
* If no entity manager name was specified, it takes the first info in the
* array as returned by the reader. Otherwise, it checks for a matching name.
* @param persistenceUnitManager the PersistenceUnitManager to obtain from
* @return the chosen PersistenceUnitInfo
*/
protected PersistenceUnitInfo determinePersistenceUnitInfo(PersistenceUnitManager persistenceUnitManager) {
if (getPersistenceUnitName() != null) {
return persistenceUnitManager.obtainPersistenceUnitInfo(getPersistenceUnitName());
}
else {
return persistenceUnitManager.obtainDefaultPersistenceUnitInfo();
}
}
示例12: EntityManagerFactoryBuilder
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
/**
* Create a new instance passing in the common pieces that will be shared if multiple
* EntityManagerFactory instances are created.
* @param jpaVendorAdapter a vendor adapter
* @param jpaProperties JPA properties to be passed to the persistence provider.
* @param persistenceUnitManager optional source of persistence unit information (can
* be null)
*/
public EntityManagerFactoryBuilder(JpaVendorAdapter jpaVendorAdapter,
Map<String, ?> jpaProperties, PersistenceUnitManager persistenceUnitManager) {
this.jpaVendorAdapter = jpaVendorAdapter;
this.persistenceUnitManager = persistenceUnitManager;
this.jpaProperties = new LinkedHashMap<String, Object>(jpaProperties);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:EntityManagerFactoryBuilder.java
示例13: setPersistenceUnitManager
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
/**
* Set the PersistenceUnitManager to use for obtaining the JPA persistence unit
* that this FactoryBean is supposed to build an EntityManagerFactory for.
* <p>The default is to rely on the local settings specified on this FactoryBean,
* such as "persistenceXmlLocation", "dataSource" and "loadTimeWeaver".
* <p>For reuse of existing persistence unit configuration or more advanced forms
* of custom persistence unit handling, consider defining a separate
* PersistenceUnitManager bean (typically a DefaultPersistenceUnitManager instance)
* and linking it in here. {@code persistence.xml} location, DataSource
* configuration and LoadTimeWeaver will be defined on that separate
* DefaultPersistenceUnitManager bean in such a scenario.
* @see #setPersistenceXmlLocation
* @see #setDataSource
* @see #setLoadTimeWeaver
* @see org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
*/
public void setPersistenceUnitManager(PersistenceUnitManager persistenceUnitManager) {
this.persistenceUnitManager = persistenceUnitManager;
}
示例14: createInternalFactoryBean
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
/**
* Creates a JPA-specific entity manager factory bean.
*
* @param manager the persistence unit manager to use.
* @return a JPA-specific entity manager factory bean.
*/
protected LocalContainerEntityManagerFactoryBean createInternalFactoryBean(PersistenceUnitManager manager) {
LocalContainerEntityManagerFactoryBean delegate = new LocalContainerEntityManagerFactoryBean();
delegate.setPersistenceUnitManager(manager);
return delegate;
}
示例15: EntityManagerFactoryBuilder
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager; //导入依赖的package包/类
/**
* Create a new instance passing in the common pieces that will be shared if multiple
* EntityManagerFactory instances are created.
* @param jpaVendorAdapter a vendor adapter
* @param properties common configuration options, including generic map for JPA
* vendor properties
* @param persistenceUnitManager optional source of persistence unit information (can
* be null)
*/
public EntityManagerFactoryBuilder(JpaVendorAdapter jpaVendorAdapter,
JpaProperties properties, PersistenceUnitManager persistenceUnitManager) {
this.delegate = new Delegate(jpaVendorAdapter, properties.getProperties(),
persistenceUnitManager);
}