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

Java AvailableSettings类代码示例

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

本文整理汇总了Java中org.hibernate.jpa.AvailableSettings的典型用法代码示例。如果您正苦于以下问题:Java AvailableSettings类的具体用法?Java AvailableSettings怎么用?Java AvailableSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AvailableSettings类属于org.hibernate.jpa包,在下文中一共展示了AvailableSettings类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setupH2EMF

import org.hibernate.jpa.AvailableSettings; //导入依赖的package包/类
private EntityManagerFactory setupH2EMF(String ddlMode) throws IOException {
  Map<String, Object> configuration = new HashMap<>();

  String jdbcUri = template("jdbc:h2:file:{{datapath}}/datastore")
      .add("datapath", BiliomiContainer.getParameters().getWorkingDir().getCanonicalPath())
      .apply();

  configuration.put("hibernate.connection.url", jdbcUri);
  configuration.put("hibernate.hbm2ddl.auto", ddlMode);

  // Add entity classes
  configuration.put(AvailableSettings.LOADED_CLASSES, scanForEntityClasses());

  // Create Entity manager factory
  logger.debug("Creating entity manager factory for local H2 database...");
  HibernatePersistenceProvider provider = new HibernatePersistenceProvider();
  return provider.createEntityManagerFactory("Biliomi-H2-DS", configuration);
}
 
开发者ID:Juraji,项目名称:Biliomi,代码行数:19,代码来源:EntityManagerFactoryProducer.java


示例2: testCascadeLockOnManagedEntityWithAssociationsInitializedAndJpa

import org.hibernate.jpa.AvailableSettings; //导入依赖的package包/类
@Test
public void testCascadeLockOnManagedEntityWithAssociationsInitializedAndJpa() throws InterruptedException {
    LOGGER.info("Test lock cascade for managed entity");
    doInJPA(entityManager -> {
        Post post = entityManager.createQuery(
                "select p " +
                        "from Post p " +
                        "join fetch p.details " +
                        "where p.id = :id", Post.class)
                .setParameter("id", 1L)
                .getSingleResult();
        entityManager.lock(post, LockModeType.PESSIMISTIC_WRITE, Collections.singletonMap(
            AvailableSettings.LOCK_SCOPE, PessimisticLockScope.EXTENDED
        ));
    });
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:17,代码来源:CascadeLockTest.java


示例3: configureRunsBeforeSessionFactoryCreation

import org.hibernate.jpa.AvailableSettings; //导入依赖的package包/类
@Test
public void configureRunsBeforeSessionFactoryCreation(){
    final String expectedFactoryName = "Dropwizard Hibernate JPA Test Factory";
    final EntityManagerFactoryFactory customFactory = new EntityManagerFactoryFactory() {
        @Override
        protected void configure(PersistenceUnitConfig configuration) {
            super.configure(configuration);
            configuration.setProperty(AvailableSettings.ENTITY_MANAGER_FACTORY_NAME, expectedFactoryName);
        }
    };
    entityManagerFactory = customFactory.build(bundle,
            environment,
            config,
            ImmutableList.<Class<?>>of(Person.class));

    assertThat(entityManagerFactory.getProperties().get(AvailableSettings.ENTITY_MANAGER_FACTORY_NAME)).isSameAs(expectedFactoryName);
}
 
开发者ID:scottescue,项目名称:dropwizard-entitymanager,代码行数:18,代码来源:EntityManagerFactoryFactoryTest.java


示例4: configurePersistenceUnit

import org.hibernate.jpa.AvailableSettings; //导入依赖的package包/类
@Contribute(EntityManagerSource.class)
public static void configurePersistenceUnit(
        MappedConfiguration<String, PersistenceUnitConfigurer> cfg,
        final ObjectLocator objectLocator)
{
        PersistenceUnitConfigurer configurer = new PersistenceUnitConfigurer()
    {
        @Override
        public void configure(TapestryPersistenceUnitInfo unitInfo)
        {
            unitInfo.transactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL)
                    .persistenceProviderClassName("org.hibernate.jpa.HibernatePersistenceProvider")
                    .excludeUnlistedClasses(false)
                    .addProperty("javax.persistence.jdbc.user", "sa")
                    .addProperty("javax.persistence.jdbc.password", "sa")
                    .addProperty("javax.persistence.jdbc.driver", "org.h2.Driver")
                    .addProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:jpatest_hibernate")
                    .addProperty("hibernate.hbm2ddl.auto", "update")
                    .addProperty("hibernate.show_sql", "true");

            unitInfo.getProperties().put(AvailableSettings.CDI_BEAN_MANAGER,
                    objectLocator.autobuild(TapestryCDIBeanManagerForJPAEntityListeners.class));
        }
    };
    cfg.add("jpatest", configurer);
}
 
开发者ID:satago,项目名称:tapestry-jpa-transactions,代码行数:27,代码来源:HibernateJpaTestModule.java


示例5: setupMySQLEMF

import org.hibernate.jpa.AvailableSettings; //导入依赖的package包/类
private EntityManagerFactory setupMySQLEMF(String ddlMode) {
  Map<String, Object> configuration = new HashMap<>();
  USMySQL mySQL = yamlCoreSettings.getBiliomi().getDatabase().getMySQL();
  boolean useSSL = mySQL.isUsessl();

  // Biliomi doesn't need the MySQL server to be in the correct timezone since all dates
  // are persisted as ISO8601, but a server might stall connection if this isn't set.
  TimeZone timeZone = Calendar.getInstance().getTimeZone();
  configuration.put("hibernate.connection.serverTimezone", timeZone.getID());

  String jdbcUri = template("jdbc:mysql://{{host}}:{{port}}/{{database}}")
      .add("host", mySQL::getHost)
      .add("port", mySQL::getPort)
      .add("database", mySQL::getDatabase)
      .apply();

  configuration.put("hibernate.connection.url", jdbcUri);
  configuration.put("hibernate.connection.username", mySQL.getUsername());
  configuration.put("hibernate.connection.password", mySQL.getPassword());
  configuration.put("hibernate.connection.useSSL", String.valueOf(useSSL));
  configuration.put("hibernate.hbm2ddl.auto", ddlMode);

  // Add entity classes
  configuration.put(AvailableSettings.LOADED_CLASSES, scanForEntityClasses());

  // Create Entity manager factory
  logger.debug("Creating entity manager factory for MySQL database...");
  HibernatePersistenceProvider provider = new HibernatePersistenceProvider();
  return provider.createEntityManagerFactory("Biliomi-MySQL-DS", configuration);
}
 
开发者ID:Juraji,项目名称:Biliomi,代码行数:31,代码来源:EntityManagerFactoryProducer.java


示例6: testCascadeLockOnManagedEntityWithJPA

import org.hibernate.jpa.AvailableSettings; //导入依赖的package包/类
@Test
public void testCascadeLockOnManagedEntityWithJPA() throws InterruptedException {
    LOGGER.info("Test lock cascade for managed entity");
    doInJPA(entityManager -> {
        Post post = entityManager.find(Post.class, 1L);
        entityManager.lock(post, LockModeType.PESSIMISTIC_WRITE, Collections.singletonMap(
            AvailableSettings.LOCK_SCOPE, PessimisticLockScope.EXTENDED
        ));
    });
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:11,代码来源:CascadeLockTest.java


示例7: testCascadeLockOnManagedEntityWithAssociationsUninitializedAndJpa

import org.hibernate.jpa.AvailableSettings; //导入依赖的package包/类
@Test
public void testCascadeLockOnManagedEntityWithAssociationsUninitializedAndJpa() throws InterruptedException {
    LOGGER.info("Test lock cascade for managed entity");
    doInJPA(entityManager -> {
        Post post = entityManager.find(Post.class, 1L);
        entityManager.lock(post, LockModeType.PESSIMISTIC_WRITE, Collections.singletonMap(
            AvailableSettings.LOCK_SCOPE, PessimisticLockScope.EXTENDED
        ));
    });
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:11,代码来源:CascadeLockElementCollectionTest.java


示例8: testSetEnhancerPropertyGeneratesWarning

import org.hibernate.jpa.AvailableSettings; //导入依赖的package包/类
@Test
public void testSetEnhancerPropertyGeneratesWarning() {
    persistenceUnitInfo.setProperty(AvailableSettings.ENHANCER_ENABLE_ASSOCIATION_MANAGEMENT, "true");
    verify(logger).warn(contains(AvailableSettings.ENHANCER_ENABLE_ASSOCIATION_MANAGEMENT));
}
 
开发者ID:scottescue,项目名称:dropwizard-entitymanager,代码行数:6,代码来源:PersistenceUnitInfoImplTest.java



注:本文中的org.hibernate.jpa.AvailableSettings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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