List of usage examples for org.hibernate.boot.spi InFlightMetadataCollector getBootstrapContext
BootstrapContext getBootstrapContext();
From source file:com.blazebit.persistence.integration.hibernate.Hibernate53MetadataContributor.java
License:Apache License
@Override public void contribute(InFlightMetadataCollector metadataCollector, IndexView jandexIndex) { ServiceBinding.ServiceLifecycleOwner lifecycleOwner = (ServiceBinding.ServiceLifecycleOwner) metadataCollector .getBootstrapContext().getServiceRegistry(); lifecycleOwner// ww w . ja va2s. c o m .configureService(new ServiceBinding<>(lifecycleOwner, Hibernate53MetadataContributor.class, this)); Object existingStrategy = configurationValues.get("hibernate.hql.bulk_id_strategy"); if (existingStrategy == null) { JdbcServices jdbcService = metadataCollector.getBootstrapContext().getServiceRegistry() .getService(JdbcServices.class); MultiTableBulkIdStrategy defaultMultiTableBulkIdStrategy = jdbcService.getDialect() .getDefaultMultiTableBulkIdStrategy(); configurationValues.put("hibernate.hql.bulk_id_strategy", new CustomMultiTableBulkIdStrategy(defaultMultiTableBulkIdStrategy)); } else { LOG.warning("Can't replace hibernate.hql.bulk_id_strategy because it was overridden by the user with: " + existingStrategy); } // Skip if already registered if (metadataCollector .getEntityBinding("com.blazebit.persistence.impl.function.entity.ValuesEntity") != null) { return; } MetadataBuildingContext metadataBuildingContext = new MetadataBuildingContextRootImpl( metadataCollector.getBootstrapContext(), metadataCollector.getMetadataBuildingOptions(), metadataCollector); addEntity("com.blazebit.persistence.impl.function.entity.ValuesEntity", metadataBuildingContext); }