Class SessionFactoryConfiguration

java.lang.Object
net.sf.basedb.core.hibernate.SessionFactoryConfiguration

@Deprecated
public class SessionFactoryConfiguration
extends Object
Class for holding configuration options for creating extra session factories for services. Used by ServiceSessionControl#buildSessionFactory(SessionFactoryConfiguration).

This class has been deprecated and can no longer be used for configuring session factories. Extensions should use ServiceSessionControl.createSessionFactoryConfiguration(String, String, int, ClassLoader) instead which will provide similar functionality.

Since:
3.4
Author:
nicklas
  • Constructor Details

    • SessionFactoryConfiguration

      public SessionFactoryConfiguration​(String schema, ClassLoader loader)
      Deprecated.
      Create a configuration instance. A schema is required and is the place were tabales for configured classes will be created. A class loader is needed so that Hibernate can load the classes from extension classes. It is recommended that an "application id" and schema version is set by calling setSchemaVersion(String, int). Then, BASE can check the currently installed schema version and only update the database if there is a change. Note that the schema version must always increase from one version to the next. Use getHibernateConfig() to retrieve the backend Hibernate configuration instance. If you have annotated entity classes you can add them with Configuration.addAnnotatedClass(Class), but there are a lots of other configuration possibilities that are beyond the scope of this documentation. A good Hibernate tutorial is recommended (eg. http://hibernate.org/orm/documentation/) Also note that by default the configured session factory need to be "piggy-backed" on a BASE DbControl transaction. Create Hibernate sessions with ServiceSessionControl.newSession(org.hibernate.SessionBuilder, DbControl). If you want to use connections/transactions that are independent from BASE call useSeparateConnections() but make sure you also get connection pooling configured. You can still use "piggy-backed" connections.
      Parameters:
      schema - The schema name the extension wants to use for it's database tables
      loader - The class loader that can load classes for the extension (needed by Hibernate)
  • Method Details

    • getSchema

      public String getSchema()
      Deprecated.
      Get the schema.
    • getClassLoader

      public ClassLoader getClassLoader()
      Deprecated.
      Get the schema.
    • getHibernateConfig

      public Configuration getHibernateConfig()
      Deprecated.
      Get the underlying Hibernate configuration instance. You will need this to defined mappings between entities and database tables.
    • setSchemaVersion

      public void setSchemaVersion​(String appId, int schemaVersion)
      Deprecated.
      Set the schema version of the current configuration. If this information has been set, BASE will check the current schema version registration and only issue a database update in case the registered schema version is lower than the given. If the registered version is higher the session factory creation fails. If no schema version has been set, BASE will always try a database update.
      Parameters:
      appId - The application ID
      schemaVersion - The schema version to install
    • getAppId

      public String getAppId()
      Deprecated.
      Get the application id for schema versioning.
    • getSchemaVersion

      public int getSchemaVersion()
      Deprecated.
      Get the schema version of the current configuration.
    • getInstalledSchemaVersion

      public int getInstalledSchemaVersion()
      Deprecated.
      Get the schema version that was installed prior to updating it. Note that this value is only available after calling ServiceSessionControl#buildSessionFactory(SessionFactoryConfiguration).
    • setInstalledSchemaVersion

      public void setInstalledSchemaVersion​(int schemaVersion)
      Deprecated.
      Callback intended for BASE core to set the installed schema version.
    • useSeparateConnections

      public boolean useSeparateConnections()
      Deprecated.
      Should the session factory be configured to use separate connections or is piggy-backed sessions required?
    • setUseSeparateConnections

      public void setUseSeparateConnections​(boolean separate)
      Deprecated.
      Set to TRUE to use connections separate from BASE connections. If you enable this, you will probably also want to configure connection pooling since the default connection pooling is not recommended for production use. Connection pooling is configured on getHibernateConfig() object. Basically you need to set the 'connection.provider_class' property to 'org.hibernate.connection.C3P0ConnectionProvider' and some other properties. You'll need to look for this documentation in other places.