public class ServiceSessionControl.SessionFactoryConfiguration
extends java.lang.Object
ServiceSessionControl.createSessionFactoryConfiguration(String, String, int, ClassLoader)
2. Set configuration properties on getRegistryBuilder()
3. Add mapped entity classes on getMetadataSources()
4. Build the session factory: ServiceSessionControl.buildSessionFactory(SessionFactoryConfiguration)
Store the created session factory in a service instance variable. When a
database connection is needed use:
1. ServiceSessionControl.newSession(SessionBuilder, DbControl)
: for a transaction that is piggy-backed on
a BASE DbControl
2. SessionFactory.openSession()
: for a standalone transaction.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
actualCatalog |
private java.lang.String |
actualSchema |
private java.lang.String |
appId |
private java.lang.ClassLoader |
classLoader |
private int |
installedSchemaVersion |
private SchemaGenerator.Mode |
installMode |
private org.hibernate.boot.MetadataSources |
metadataSources |
private StandardServiceRegistryBuilder |
registryBuilder |
private java.lang.String |
schema |
private int |
schemaVersion |
private boolean |
useSeparateConnections |
Constructor and Description |
---|
SessionFactoryConfiguration(java.lang.String appId,
java.lang.String schema,
int schemaVersion,
java.lang.ClassLoader classLoader) |
Modifier and Type | Method and Description |
---|---|
private void |
checkLocked(java.lang.String method)
Check that the
|
java.lang.String |
getActualCatalog()
The actual catalog that will be used by BASE.
|
java.lang.String |
getActualSchema()
The actual schema that will be used by BASE.
|
java.lang.String |
getAppId()
Get the application id for schema versioning.
|
java.lang.ClassLoader |
getClassLoader()
Get the class loader used for accessing mapped classes.
|
int |
getInstalledSchemaVersion()
Get the currently installed version of the schema or
0 if not installed.
|
SchemaGenerator.Mode |
getInstallMode()
Get the installation mode that BASE will use when creating the session
factory.
|
org.hibernate.boot.MetadataSources |
getMetadataSources()
Get an object for registering mapped entity classes.
|
StandardServiceRegistryBuilder |
getRegistryBuilder()
Get the registry for collecting configuration options.
|
java.lang.String |
getSchema()
Get the schema.
|
int |
getSchemaVersion()
Get the schema version of the current configuration.
|
(package private) void |
init() |
void |
setUseSeparateConnections(boolean separate)
Set to TRUE to use connections separate from BASE connections.
|
boolean |
useSeparateConnections()
Should the session factory be configured to use separate
connections or is piggy-backed sessions required?
|
private final java.lang.String appId
private final java.lang.String schema
private final int schemaVersion
private final java.lang.ClassLoader classLoader
private StandardServiceRegistryBuilder registryBuilder
private org.hibernate.boot.MetadataSources metadataSources
private java.lang.String actualCatalog
private java.lang.String actualSchema
private SchemaGenerator.Mode installMode
private int installedSchemaVersion
private boolean useSeparateConnections
SessionFactoryConfiguration(java.lang.String appId, java.lang.String schema, int schemaVersion, java.lang.ClassLoader classLoader)
void init()
public java.lang.String getSchema()
public java.lang.String getAppId()
public int getSchemaVersion()
public SchemaGenerator.Mode getInstallMode()
public int getInstalledSchemaVersion()
public java.lang.String getActualSchema()
public java.lang.String getActualCatalog()
public java.lang.ClassLoader getClassLoader()
public void setUseSeparateConnections(boolean separate)
getRegistryBuilder()
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.public boolean useSeparateConnections()
private void checkLocked(java.lang.String method)
public StandardServiceRegistryBuilder getRegistryBuilder()
hibernate.dialect hibernate.connection_driver_class hibernate.default_catalog hibernate.default_schema hibernate.connection.url hibernate.connection.username hibernate.connection.password
The registry must be fully configured before calling getMetadataSources()
.
This method will throw an exception if called in the incorrect order.
public org.hibernate.boot.MetadataSources getMetadataSources()