Class StandardServiceRegistryBuilder

    • Field Detail

      • DEFAULT_CFG_RESOURCE_NAME

        public static final java.lang.String DEFAULT_CFG_RESOURCE_NAME
        The default resource name for a hibernate configuration xml file.
        See Also:
        Constant Field Values
    • Constructor Detail

      • StandardServiceRegistryBuilder

        public StandardServiceRegistryBuilder()
        Create a default builder.
      • StandardServiceRegistryBuilder

        public StandardServiceRegistryBuilder​(BootstrapServiceRegistry bootstrapServiceRegistry)
        Create a builder with the specified bootstrap services.
        Parameters:
        bootstrapServiceRegistry - Provided bootstrap registry to use.
      • StandardServiceRegistryBuilder

        public StandardServiceRegistryBuilder​(BootstrapServiceRegistry bootstrapServiceRegistry,
                                              LoadedConfig loadedConfigBaseline)
        Create a builder with the specified bootstrap services.
        Parameters:
        bootstrapServiceRegistry - Provided bootstrap registry to use.
    • Method Detail

      • forJpa

        public static StandardServiceRegistryBuilder forJpa​(BootstrapServiceRegistry bootstrapServiceRegistry)
        Intended only for use from EntityManagerFactoryBuilderImpl. Creates a StandardServiceRegistryBuilder specific to the needs of JPA bootstrapping. Specifically we ignore properties found in `cfg.xml` files in terms of adding them to the builder immediately. EntityManagerFactoryBuilderImpl handles collecting these properties itself.
      • getConfigLoader

        public org.hibernate.boot.cfgxml.internal.ConfigLoader getConfigLoader()
      • getAggregatedCfgXml

        public LoadedConfig getAggregatedCfgXml()
        Intended for internal testing use only!!
      • configure

        public StandardServiceRegistryBuilder configure​(java.lang.String resourceName)
        Read setting information from an XML file using the named resource location.
        Parameters:
        resourceName - The named resource
        Returns:
        this, for method chaining
      • applySetting

        public StandardServiceRegistryBuilder applySetting​(java.lang.String settingName,
                                                           java.lang.Object value)
        Apply a setting value.
        Parameters:
        settingName - The name of the setting
        value - The value to use.
        Returns:
        this, for method chaining
      • applySettings

        public StandardServiceRegistryBuilder applySettings​(java.util.Map settings)
        Apply a groups of setting values.
        Parameters:
        settings - The incoming settings to apply
        Returns:
        this, for method chaining
      • clearSettings

        public void clearSettings()
      • addService

        public StandardServiceRegistryBuilder addService​(java.lang.Class serviceRole,
                                                         Service service)
        Adds a user-provided service.
        Parameters:
        serviceRole - The role of the service being added
        service - The service implementation
        Returns:
        this, for method chaining
      • disableAutoClose

        public StandardServiceRegistryBuilder disableAutoClose()
        By default, when a ServiceRegistry is no longer referenced by any other registries as a parent it will be closed.

        Some applications that explicitly build "shared registries" may want to circumvent that behavior.

        This method indicates that the registry being built should not be automatically closed. The caller agrees to take responsibility to close it themselves.

        Returns:
        this, for method chaining
      • build

        public StandardServiceRegistry build()
        Build the StandardServiceRegistry.
        Returns:
        The StandardServiceRegistry.
      • getSettings

        @Deprecated
        public java.util.Map getSettings()
        Deprecated.
        Temporarily exposed since Configuration is still around and much code still uses Configuration. This allows code to configure the builder and access that to configure Configuration object.
        Temporarily exposed since Configuration is still around and much code still uses Configuration. This allows code to configure the builder and access that to configure Configuration object (used from HEM atm).
        Returns:
        The settings map.
      • destroy

        public static void destroy​(ServiceRegistry serviceRegistry)
        Destroy a service registry. Applications should only destroy registries they have explicitly created.
        Parameters:
        serviceRegistry - The registry to be closed.