本文整理汇总了Java中org.apache.openjpa.persistence.PersistenceProviderImpl类的典型用法代码示例。如果您正苦于以下问题:Java PersistenceProviderImpl类的具体用法?Java PersistenceProviderImpl怎么用?Java PersistenceProviderImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistenceProviderImpl类属于org.apache.openjpa.persistence包,在下文中一共展示了PersistenceProviderImpl类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: OpenSpacesPersistenceProvider
import org.apache.openjpa.persistence.PersistenceProviderImpl; //导入依赖的package包/类
public OpenSpacesPersistenceProvider() {
_persistenceProvider = new PersistenceProviderImpl();
}
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:4,代码来源:OpenSpacesPersistenceProvider.java
示例2: testCreationUsingJTATransactionMode
import org.apache.openjpa.persistence.PersistenceProviderImpl; //导入依赖的package包/类
@Test
public void testCreationUsingJTATransactionMode() throws Exception {
Factory factory = mock(Factory.class);
when(factory.createComponentInstance(any(Dictionary.class))).thenReturn(mock(ComponentInstance.class));
Bundle bundle = mock(Bundle.class);
when(bundle.getVersion()).thenReturn(new Version(1,0,0));
BundleWiring wiring = mock(BundleWiring.class);
when(wiring.getClassLoader()).thenReturn(this.getClass().getClassLoader());
when(bundle.adapt(BundleWiring.class)).thenReturn(wiring);
BundleContext context = mock(BundleContext.class);
when(context.getBundle()).thenReturn(bundle);
when(bundle.getBundleContext()).thenReturn(context);
when(context.registerService(any(Class.class), any(), any(Dictionary.class))).thenReturn(mock(ServiceRegistration.class));
Persistence.PersistenceUnit pu = new Persistence.PersistenceUnit();
pu.setName("unit-test");
pu.setJtaDataSource("data");
pu.setNonJtaDataSource("data");
pu.setTransactionType(PersistenceUnitTransactionType.fromValue("JTA"));
pu.getClazz().add(Student.class.getName());
final Persistence.PersistenceUnit.Properties properties = new Persistence.PersistenceUnit.Properties();
final Persistence.PersistenceUnit.Properties.Property property
= new Persistence.PersistenceUnit.Properties.Property();
property.setName("location");
property.setValue("META-INF/persistence.xml");
properties.getProperty().add(property);
pu.setProperties(properties);
PersistentBundle pb = new PersistentBundle(bundle, ImmutableSet.of(pu), factory);
PersistenceUnitComponent component = new PersistenceUnitComponent(pb, pu, context);
H2Service h2 = new H2Service();
DataSource ds = h2.createDataSource(getDataSourceProperties());
component.jtaDataSource = ds;
component.nonJtaDataSource = ds;
component.provider = new PersistenceProviderImpl();
component.transformer = mock(JPATransformer.class);
component.start();
// Check registration
assertThat(component.emfRegistration).isNotNull();
assertThat(component.emRegistration).isNotNull();
component.shutdown();
}
开发者ID:wisdom-framework,项目名称:wisdom-jdbc,代码行数:45,代码来源:PersistenceUnitComponentTest.java
示例3: testCreationUsingResourceLocalTransactionMode
import org.apache.openjpa.persistence.PersistenceProviderImpl; //导入依赖的package包/类
@Test
public void testCreationUsingResourceLocalTransactionMode() throws Exception {
Factory factory = mock(Factory.class);
when(factory.createComponentInstance(any(Dictionary.class))).thenReturn(mock(ComponentInstance.class));
Bundle bundle = mock(Bundle.class);
when(bundle.getVersion()).thenReturn(new Version(1,0,0));
BundleWiring wiring = mock(BundleWiring.class);
when(wiring.getClassLoader()).thenReturn(this.getClass().getClassLoader());
when(bundle.adapt(BundleWiring.class)).thenReturn(wiring);
BundleContext context = mock(BundleContext.class);
when(context.getBundle()).thenReturn(bundle);
when(bundle.getBundleContext()).thenReturn(context);
when(context.registerService(any(Class.class), any(), any(Dictionary.class))).thenReturn(mock(ServiceRegistration.class));
Persistence.PersistenceUnit pu = new Persistence.PersistenceUnit();
pu.setName("unit-test");
pu.setJtaDataSource("data");
pu.setNonJtaDataSource("data");
pu.setTransactionType(
PersistenceUnitTransactionType.fromValue("RESOURCE_LOCAL"));
pu.getClazz().add(Student.class.getName());
final Persistence.PersistenceUnit.Properties properties = new Persistence.PersistenceUnit.Properties();
final Persistence.PersistenceUnit.Properties.Property property
= new Persistence.PersistenceUnit.Properties.Property();
property.setName("location");
property.setValue("META-INF/persistence.xml");
properties.getProperty().add(property);
pu.setProperties(properties);
PersistentBundle pb = new PersistentBundle(bundle, ImmutableSet.of(pu), factory);
PersistenceUnitComponent component = new PersistenceUnitComponent(pb, pu, context);
H2Service h2 = new H2Service();
DataSource ds = h2.createDataSource(getDataSourceProperties());
component.jtaDataSource = ds;
component.nonJtaDataSource = ds;
component.provider = new PersistenceProviderImpl();
component.transformer = mock(JPATransformer.class);
component.start();
// Check registration
assertThat(component.emfRegistration).isNotNull();
assertThat(component.emRegistration).isNotNull();
component.shutdown();
}
开发者ID:wisdom-framework,项目名称:wisdom-jdbc,代码行数:46,代码来源:PersistenceUnitComponentTest.java
注:本文中的org.apache.openjpa.persistence.PersistenceProviderImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论