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

Java ImplicitNamingStrategyJpaCompliantImpl类代码示例

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

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



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

示例1: metadataBuilder

import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl; //导入依赖的package包/类
private Block metadataBuilder() {
  return unit -> {
    MetadataBuilder mb = unit.get(MetadataBuilder.class);
    expect(mb.applyImplicitNamingStrategy(ImplicitNamingStrategyJpaCompliantImpl.INSTANCE))
        .andReturn(mb);
    expect(mb.applyScanEnvironment(unit.get(ScanEnvironment.class))).andReturn(mb);

    SessionFactoryBuilder sfb = unit.mock(SessionFactoryBuilder.class);
    unit.registerMock(SessionFactoryBuilder.class, sfb);

    Metadata md = unit.mock(Metadata.class);
    expect(md.getSessionFactoryBuilder()).andReturn(sfb);

    expect(mb.build()).andReturn(md);

    unit.registerMock(Metadata.class, md);
  };
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:19,代码来源:HbmTest.java


示例2: buildFactory

import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl; //导入依赖的package包/类
@Override
	public SessionFactory buildFactory(String configFile) {
		try {
			//configuration = new Configuration().configure(configFile);
//			StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()
//			.applySettings(configuration.getProperties());
//			SessionFactory factory2 = configuration.buildSessionFactory(builder.build());
			
			
			StandardServiceRegistry standardRegistry = new   StandardServiceRegistryBuilder()
				    .configure(configFile)
				    .build();

			MetadataSources metadataSources = new MetadataSources( standardRegistry );
			
			DomainScanner instanceFromProperties = getScanner(configFile);
			List<Class<? extends BaseDatabaseDomain>> scan = instanceFromProperties.scan(configFile);
			for(Class<? extends BaseDatabaseDomain> temp:scan){
				metadataSources.addAnnotatedClass(temp);
			}
			
		//	new HibernateUtil().scanDomain(metadataSources);
			
			Metadata metadata = metadataSources.getMetadataBuilder()
			    .applyImplicitNamingStrategy( ImplicitNamingStrategyJpaCompliantImpl.INSTANCE )
			    .build();

			SessionFactory factory2 = metadata.getSessionFactoryBuilder().build();
		
			
			return factory2;
			/*ProxoolConnectionProvider aConnectionProvider;*/
		} catch (Exception e) {
			steed.util.logging.LoggerFactory.getLogger().error("创建sessionFactory失败",e);
		}
		return null;
	}
 
开发者ID:battlesteed,项目名称:hibernateMaster,代码行数:38,代码来源:SingleFactoryEngine.java


示例3: configure

import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl; //导入依赖的package包/类
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
  Key<DataSource> dskey = Key.get(DataSource.class, Names.named(name));
  DataSource ds = env.get(dskey)
      .orElseThrow(() -> new NoSuchElementException("DataSource missing: " + dskey));

  BootstrapServiceRegistryBuilder bsrb = new BootstrapServiceRegistryBuilder();
  bsrb.applyIntegrator(new JpaIntegrator());

  this.bsrb.accept(bsrb, conf);

  String ddl_auto = env.name().equals("dev") ? "update" : "none";

  BootstrapServiceRegistry bsr = bsrb.build();
  StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder(bsr);
  ssrb.applySetting(AvailableSettings.HBM2DDL_AUTO, ddl_auto);

  ssrb.applySettings(settings(env, conf));

  this.ssrb.accept(ssrb, conf);

  ssrb.applySetting(AvailableSettings.DATASOURCE, ds);
  ssrb.applySetting(org.hibernate.jpa.AvailableSettings.DELAY_CDI_ACCESS, true);

  StandardServiceRegistry serviceRegistry = ssrb.build();

  MetadataSources sources = new MetadataSources(serviceRegistry);
  this.sources.forEach(src -> src.accept(sources, conf));
  this.metaSources.accept(sources, conf);

  /** scan package? */
  List<URL> packages = sources.getAnnotatedPackages()
      .stream()
      .map(pkg -> getClass().getResource("/" + pkg.replace('.', '/')))
      .collect(Collectors.toList());

  Metadata metadata = sources.getMetadataBuilder()
      .applyImplicitNamingStrategy(ImplicitNamingStrategyJpaCompliantImpl.INSTANCE)
      .applyScanEnvironment(new ScanEnvImpl(packages))
      .build();

  SessionFactoryBuilder sfb = metadata.getSessionFactoryBuilder();
  this.sfb.accept(sfb, conf);
  sfb.applyName(name);

  CompletableFuture<Registry> registry = new CompletableFuture<>();
  sfb.applyBeanManager(GuiceBeanManager.beanManager(registry));

  SessionFactory sessionFactory = sfb.build();
  this.sf.accept(sessionFactory, conf);

  Provider<Session> session = new SessionProvider(sessionFactory);

  ServiceKey serviceKey = env.serviceKey();
  serviceKey.generate(SessionFactory.class, name,
      k -> binder.bind(k).toInstance(sessionFactory));
  serviceKey.generate(EntityManagerFactory.class, name,
      k -> binder.bind(k).toInstance(sessionFactory));

  /** Session/Entity Manager . */
  serviceKey.generate(Session.class, name,
      k -> binder.bind(k).toProvider(session));
  serviceKey.generate(EntityManager.class, name,
      k -> binder.bind(k).toProvider(session));

  /** Unit of work . */
  Provider<UnitOfWork> uow = new UnitOfWorkProvider(sessionFactory);
  serviceKey.generate(UnitOfWork.class, name,
      k -> binder.bind(k).toProvider(uow));

  bindings.forEach(it -> it.accept(binder));

  env.onStart(r -> {
    registry.complete(r);
    listeners.forEach(it -> it.accept((SessionFactoryImplementor) sessionFactory, r));
  });

  env.onStop(sessionFactory::close);
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:80,代码来源:Hbm.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ExchangeFactory类代码示例发布时间:2022-05-22
下一篇:
Java WSDL2Constants类代码示例发布时间: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