当前位置: 首页>>代码示例>>Java>>正文


Java ImplicitNamingStrategyJpaCompliantImpl类代码示例

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