• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PersistenceProviderImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NodeUtil类代码示例发布时间:2022-05-22
下一篇:
Java SACMediaList类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap