Class ServiceSessionControl

  • All Implemented Interfaces:
    AutoCloseable

    public class ServiceSessionControl
    extends SessionControl
    A special session control implementation used for services. It provides extra functionality that an extension can use to create database objects in a separate database schema/catalog for their own use. Note that the extra API in this class depends on Hibernate API and may change without notification in case the Hibernate API is changed (though we will try to give advanced notice).
    Since:
    3.4
    Author:
    nicklas
    • Field Detail

      • log

        private static final org.slf4j.Logger log
    • Constructor Detail

      • ServiceSessionControl

        ServiceSessionControl()
    • Method Detail

      • getCatalog

        String getCatalog()
      • schemaExists

        boolean schemaExists​(String catalog,
                             String schema)
      • buildSessionFactory

        public SessionFactory buildSessionFactory​(ServiceSessionControl.SessionFactoryConfiguration config)
        Create a session factory for the given configuration. This method will add connection information from the base.config file automatically to the configuration object. Note that sessions can't Classes that have been defined in the configuration should be without a schema definition and will then be put into the specified schema automatically. If the given schema and tables doesn't exists they will be created automatically, otherwise an UPDATE action is performed to modify an existing installation.
        Parameters:
        config - A configuration instance containing information needed to build the session factory
        Returns:
        A session factory instance
      • newSession

        public Session newSession​(SessionBuilder<?> builder,
                                  DbControl dc)
        Create a new Hibernate session for the given session factory that is piggy-backed on the given DbControl transaction. Note that the life-cycle of the returned session is managed by the DbControl. There is no need to flush or close the session since this is done automatically and may cause exceptions if done when not needed.
        Parameters:
        builder - A session builder (eg. SessionFactory.withOptions())
        dc - An open DbControl