Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

LocalSessionFactoryObject Members

LocalSessionFactoryObject overview

Protected Static (Shared) Fields

log The shared ILog instance for this class (and derived classes).

Public Instance Constructors

LocalSessionFactoryObject Constructor Initializes a new instance of the LocalSessionFactoryObject class.

Public Instance Properties

AdoExceptionTranslator Set the ADO.NET exception translator for this instance. Applied to System.Data.Common.DbException (or provider specific exception type in .NET 1.1) thrown by callback code, be it direct DbException or wrapped Hibernate ADOExceptions. The default exception translator is either a ErrorCodeExceptionTranslator if a DbProvider is available, or a FalbackExceptionTranslator otherwise
CollectionCacheStrategies Specify the cache strategies for persistent collections (with specific roles). This configuration setting corresponds to the <collection-cache> entry in the "hibernate.cfg.xml" configuration format. For example:
 <property name="CollectionCacheStrategies"> <props> <prop key="MyCompany.Order.Items">read-write</prop> <prop key="MyCompany.Product.Categories">read-only,myRegion</prop> </props> </property>
ConfigFilenames Sets the hibernate configuration files to load, i.e. hibernate.cfg.xml.
Configuration Return the Configuration object used to build the SessionFactory. Allows access to configuration metadata stored there (rarely needed).
DbProvider Get or set the DataSource to be used by the SessionFactory.
EntityCacheStrategies Specify the cache strategies for entities (persistent classes or named entities). This configuration setting corresponds to the <class-cache> entry in the "hibernate.cfg.xml" configuration format. For example:
 <property name="entityCacheStrategies"> <props> <prop key="MyCompany.Customer">read-write</prop> <prop key="MyCompany.Product">read-only,myRegion</prop> </props> </property>
EntityInterceptor Set a NHibernate entity interceptor that allows to inspect and change property values before writing to and reading from the database. Will get applied to any new Session created by this factory. Such an interceptor can either be set at the SessionFactory level, i.e. on LocalSessionFactoryObject, or at the Session level, i.e. on HibernateTemplate, HibernateInterceptor, and HibernateTransactionManager. It's preferable to set it on LocalSessionFactoryObject or HibernateTransactionManager to avoid repeated configuration and guarantee consistent behavior in transactions.
EventListeners Specify the NHibernate event listeners to register, with listener types as keys and listener objects as values. Instead of a single listener object, you can also pass in a list or set of listeners objects as value.
ExposeTransactionAwareSessionFactory Gets or sets a value indicating whether to expose a transaction aware session factory.
FilterDefinitions Specify the NHibernate FilterDefinitions to register with the SessionFactory. This is an alternative to specifying <filter-def> elements in Hibernate mapping files.
HibernateProperties Set NHibernate configuration properties, like "hibernate.dialect".
IsSingleton Returns true
MappingAssemblies Sets the assemblies to load that contain mapping files.
MappingResources Sets the locations of Spring IResources that contain mapping files.
NamingStrategy Set a Hibernate NamingStrategy for the SessionFactory, determining the physical column and table names given the info in the mapping document.
ObjectType Return the type ISessionFactory or subclass.
ResourceLoader Gets or sets the IResourceLoader to use for loading mapping assemblies etc.
SchemaUpdate Set whether to execute a schema update after SessionFactory initialization. For details on how to make schema update scripts work, see the NHibernate documentation, as this class leverages the same schema update script support in Configuration as NHibernate's own SchemaUpdate tool.
TypeDefinitions Specify the Hibernate type definitions to register with the SessionFactory, as Spring IObjectDefinition instances. This is an alternative to specifying <typedef> elements in Hibernate mapping files. Unfortunately, Hibernate itself does not define a complete object that represents a type definition, hence the need for Spring's TypeDefinitionBean. @see TypeDefinitionBean @see org.hibernate.cfg.Mappings#addTypeDef(String, String, java.util.Properties)

Public Instance Methods

AfterPropertiesSet Initialize the SessionFactory for the given or the default location.
CreateDatabaseSchema Execute schema creation script, determined by the Configuration object used for creating the SessionFactory. A replacement for NHibernate's SchemaExport class, to be invoked on application setup.
Dispose Close the SessionFactory on application context shutdown.
DropDatabaseSchema Execute schema drop script, determined by the Configuration object used for creating the SessionFactory. A replacement for NHibernate's SchemaExport class, to be invoked on application setup.
Equals (inherited from Object)Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object)Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetObject Return the singleon session factory.
GetType (inherited from Object)Gets the Type of the current instance.
ToString (inherited from Object)Returns a String that represents the current Object.
TranslateExceptionIfPossible Implementation of the PersistenceExceptionTranslator interface, as autodetected by Spring's PersistenceExceptionTranslationPostProcessor. Converts the exception if it is a HibernateException; else returns
null
to indicate an unknown exception. translate the given exception thrown by a persistence framework to a corresponding exception from Spring's generic DataAccessException hierarchy, if possible.
UpdateDatabaseSchema Execute schema update script, determined by the Configuration object used for creating the SessionFactory. A replacement for NHibernate's SchemaUpdate class, for automatically executing schema update scripts on application startup. Can also be invoked manually.

Protected Instance Methods

AfterSessionFactoryCreation Executes schema update if requested.
ConvertAdoAccessException Converts the ADO.NET access exception to an appropriate exception from the
org.springframework.dao
hierarchy. Can be overridden in subclasses.
ConvertHibernateException Convert the given HibernateException to an appropriate exception from the Spring's DAO Exception hierarchy. Will automatically apply a specified IAdoExceptionTranslator to a Hibernate ADOException, else rely on Hibernate's default translation.
ExecuteSchemaScript Execute the given schema script on the given ADO.NET Connection.
ExecuteSchemaStatement Execute the given schema SQL on the given ADO.NET command.
Finalize (inherited from Object)Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object)Creates a shallow copy of the current Object.
NewConfiguration Subclasses can override this method to perform custom initialization of the Configuration instance used for ISessionFactory creation.
NewSessionFactory Subclasses can override this method to perform custom initialization of the SessionFactory instance, creating it via the given Configuration object that got prepared by this LocalSessionFactoryObject.
PostProcessConfiguration To be implemented by subclasses that want to to perform custom post-processing of the Configuration object after this FactoryObject performed its default initialization.
PostProcessMappings To be implemented by subclasses that want to to register further mappings on the Configuration object after this FactoryObject registered its specified mappings.

Explicit Interface Implementations

IApplicationContextAware.ApplicationContext Setting the Application Context determines were resources are loaded from

See Also

LocalSessionFactoryObject Class | Spring.Data.NHibernate Namespace