org.sequalite.session
Class SessionFactory

java.lang.Object
  extended by org.sequalite.session.SessionFactory

public class SessionFactory
extends java.lang.Object


Method Summary
 void close()
          destroys all the Session pools
 Session createSession(java.sql.Connection connection, java.lang.String jdbcContext)
          Creates a Session using an existing connection.
 Session createSession(java.lang.String jdbcContext)
          Creates a Session using the jdbcContext.
 Session createSession(java.lang.String dsName, java.lang.String jdbcContext)
          Creates a Session using a data source.
static void forceORMappingCreation()
          forces the creation of O-R mapping when there is no .sequalite file found in a package.
static SessionFactory getInstance()
          Creates an instance of the SeQualite SessionFactory.
static SessionFactory getInstance(java.io.InputStream fis)
           Creates an Instance of SessionFactory and a) initializes logger b) initializes jdbcContexts
static SessionFactory getInstance(java.util.logging.Level sequaliteLogLevel, java.util.logging.Level sqlLogLevel)
          Creates an instance of the SeQualite SessionFactory.
static SessionFactory getInstance(java.lang.String configFilePath)
           Creates an Instance of SessionFactory and a) initializes logger b) initializes jdbcContexts
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SessionFactory getInstance()
Creates an instance of the SeQualite SessionFactory. All configurations will be defaulted. Sessions should not be created using createSession(String jdbcContext) when the factory is instantiated using this method.

Returns:

getInstance

public static SessionFactory getInstance(java.util.logging.Level sequaliteLogLevel,
                                         java.util.logging.Level sqlLogLevel)
Creates an instance of the SeQualite SessionFactory. The method createSession(String jdbcContext) should not be used when the factory is instantiated using this method.

Parameters:
sequaliteLogLevel -
sqlLogLevel -
Returns:

getInstance

public static SessionFactory getInstance(java.lang.String configFilePath)
                                  throws SeQuaLiteException
 Creates an Instance of SessionFactory and 
 a) initializes logger 
 b) initializes jdbcContexts

Parameters:
configFilePath -
Returns:
Throws:
SeQuaLiteException

getInstance

public static SessionFactory getInstance(java.io.InputStream fis)
 Creates an Instance of SessionFactory and 
 a) initializes logger 
 b) initializes jdbcContexts

Parameters:
fis -
Returns:

close

public void close()
destroys all the Session pools


createSession

public Session createSession(java.lang.String jdbcContext)
                      throws SeQuaLiteException
Creates a Session using the jdbcContext. SeQuaLite will look for the jdbcContext in the configuration file (i.e. sequalite.properties). The SessionPool is identified with this jdbcContext.

Parameters:
jdbcContext -
Returns:
Throws:
SeQuaLiteException

createSession

public Session createSession(java.sql.Connection connection,
                             java.lang.String jdbcContext)
                      throws SeQuaLiteException
Creates a Session using an existing connection. The SessionPool associated with this connection is identified with the specified jdbcContext.

Parameters:
connection -
jdbcContext -
Returns:
Throws:
SeQuaLiteException

createSession

public Session createSession(java.lang.String dsName,
                             java.lang.String jdbcContext)
                      throws SeQuaLiteException
Creates a Session using a data source. The SessionPool associated with this data source is identified with the specified jdbcContext.

Parameters:
dsName -
jdbcContext -
Returns:
Throws:
SeQuaLiteException

forceORMappingCreation

public static void forceORMappingCreation()
forces the creation of O-R mapping when there is no .sequalite file found in a package.