Castle.Facilities.ActiveRecordIntegration
Provides integration with ActiveRecord framework.
Initializes a new instance of the class.
Initializes a new instance of the class.
The custom initialization for the Facility.
It must be overriden.
Performs the tasks associated with freeing, releasing, or resetting
the facility resources.
It can be overriden.
This class implements
and delegates and
to
as the session is in fact managed by ActiveRecord framework
Initializes a new instance of the class.
The holder.
The inner session.
Force the ISession to flush.
Must be called at the end of a unit of work, before commiting the transaction and closing
the session (Transaction.Commit() calls this method). Flushing if the process
of synchronising the underlying persistent store with persistable state held in memory.
Disconnect the ISession from the current ADO.NET connection.
The connection provided by the application or
If the connection was obtained by Hibernate, close it or return it to the connection
pool. Otherwise return it to the application. This is used by applications which require
long transactions.
Obtain a new ADO.NET connection.
This is used by applications which require long transactions
Reconnect to the given ADO.NET connection.
An ADO.NET connection
This is used by applications which require long transactions
End the ISession by disconnecting from the ADO.NET connection and cleaning up.
The connection provided by the application or
It is not strictly necessary to Close() the ISession but you must
at least Disconnect() it.
Cancel execution of the current query.
May be called from one thread to stop execution of a query in another thread.
Use with care!
Does this ISession contain any changes which must be
synchronized with the database? Would any SQL be executed if
we flushed this session?
Return the identifier of an entity instance cached by the ISession
a persistent instance
the identifier
Throws an exception if the instance is transient or associated with a different
ISession
Is this instance associated with this Session?
an instance of a persistent class
true if the given instance is associated with this Session
Remove this instance from the session cache.
a persistent instance
Changes to the instance will not be synchronized with the database.
This operation cascades to associated instances if the association is mapped
with cascade="all" or cascade="all-delete-orphan".
Return the persistent instance of the given entity class with the given identifier,
obtaining the specified lock mode.
A persistent class
A valid identifier of an existing persistent instance of the class
The lock level
the persistent instance
Return the persistent instance of the given entity class with the given identifier,
assuming that the instance exists.
A persistent class
A valid identifier of an existing persistent instance of the class
The persistent instance or proxy
You should not use this method to determine if an instance exists (use a query or
instead). Use this only to retrieve an instance
that you assume exists, where non-existence would be an actual error.
Loads the specified id.
The id.
The lock mode.
Loads the specified id.
The id.
Read the persistent state associated with the given identifier into the given transient
instance.
An "empty" instance of the persistent class
A valid identifier of an existing persistent instance of the class
Return the persistent instance of the given entity class with the given identifier, or null
if there is no such persistent instance. (If the instance, or a proxy for the instance, is
already associated with the session, return that instance or proxy.)
a persistent class
an identifier
a persistent instance or null
Return the persistent instance of the given entity class with the given identifier, or null
if there is no such persistent instance. Obtain the specified lock mode if the instance
exists.
a persistent class
an identifier
the lock mode
a persistent instance or null
Return the persistent instance of the given named entity with the given identifier,
or null if there is no such persistent instance. (If the instance, or a proxy for the
instance, is already associated with the session, return that instance or proxy.)
the entity name
an identifier
a persistent instance or null
Gets the specified id.
The id.
Gets the specified id.
The id.
The lock mode.
Enable the named filter for this current session.
The name of the filter to be enabled.
The Filter instance representing the enabled fiter.
Retrieve a currently enabled filter by name.
The name of the filter to be retrieved.
The Filter instance representing the enabled fiter.
Disable the named filter for the current session.
The name of the filter to be disabled.
Create a multi query, a query that can send several
queries to the server, and return all their results in a single
call.
An that can return
a list of all the results of all the queries.
Note that each query result is itself usually a list.
Persist all reachable transient objects, reusing the current identifier
values. Note that this will not trigger the Interceptor of the Session.
Persist the state of the given detached instance, reusing the current
identifier value. This operation cascades to associated instances if
the association is mapped with cascade="replicate".
a detached instance of a persistent class
Persist the given transient instance, first assigning a generated identifier.
A transient instance of a persistent class
The generated identifier
Save will use the current value of the identifier property if the Assigned
generator is used.
Persist the given transient instance, using the given identifier.
A transient instance of a persistent class
An unused valid identifier
Persist the given transient instance, first assigning a generated identifier. (Or
using the current value of the identifier property if the assigned
generator is used.)
The Entity name.
a transient instance of a persistent class
the generated identifier
This operation cascades to associated instances if the
association is mapped with cascade="save-update".
Either Save() or Update() the given instance, depending upon the value of
its identifier property.
A transient instance containing new or updated state
By default the instance is always saved. This behaviour may be adjusted by specifying
an unsaved-value attribute of the identifier property mapping
Either or
the given instance, depending upon resolution of the unsaved-value checks
(see the manual for discussion of unsaved-value checking).
The name of the entity
a transient or detached instance containing new or updated state
This operation cascades to associated instances if the association is mapped
with cascade="save-update".
Update the persistent instance with the identifier of the given transient instance.
A transient instance containing updated state
If there is a persistent instance with the same identifier, an exception is thrown. If
the given transient instance has a identifier, an exception will be thrown.
Update the persistent state associated with the given identifier.
A transient instance containing updated state
Identifier of persistent instance
An exception is thrown if there is a persistent instance with the same identifier
in the current session.
Update the persistent instance with the identifier of the given detached
instance.
The Entity name.
a detached instance containing updated state
If there is a persistent instance with the same identifier,
an exception is thrown. This operation cascades to associated instances
if the association is mapped with cascade="save-update".
Copy the state of the given object onto the persistent object with the same
identifier. If there is no persistent instance currently associated with
the session, it will be loaded. Return the persistent instance. If the
given instance is unsaved, save a copy of and return it as a newly persistent
instance. The given instance does not become associated with the session.
This operation cascades to associated instances if the association is mapped
with cascade="merge".
The semantics of this method are defined by JSR-220.
a detached instance with state to be copied
an updated persistent instance
Copy the state of the given object onto the persistent object with the same
identifier. If there is no persistent instance currently associated with
the session, it will be loaded. Return the persistent instance. If the
given instance is unsaved, save a copy of and return it as a newly persistent
instance. The given instance does not become associated with the session.
This operation cascades to associated instances if the association is mapped
with cascade="merge".
The semantics of this method are defined by JSR-220.
The entity name
a detached instance with state to be copied
an updated persistent instance
Make a transient instance persistent. This operation cascades to associated
instances if the association is mapped with cascade="persist".
The semantics of this method are defined by JSR-220.
a transient instance to be made persistent
Make a transient instance persistent. This operation cascades to associated
instances if the association is mapped with cascade="persist".
The semantics of this method are defined by JSR-220.
The entity name.
a transient instance to be made persistent
Copy the state of the given object onto the persistent object with the same
identifier. If there is no persistent instance currently associated with
the session, it will be loaded. Return the persistent instance. If the
given instance is unsaved or does not exist in the database, save it and
return it as a newly persistent instance. Otherwise, the given instance
does not become associated with the session.
a transient instance with state to be copied
an updated persistent instance
Copy the state of the given object onto the persistent object with the
given identifier. If there is no persistent instance currently associated
with the session, it will be loaded. Return the persistent instance. If
there is no database row with the given identifier, save the given instance
and return it as a newly persistent instance. Otherwise, the given instance
does not become associated with the session.
a persistent or transient instance with state to be copied
the identifier of the instance to copy to
an updated persistent instance
Remove a persistent instance from the datastore.
The instance to be removed
The argument may be an instance associated with the receiving ISession or a
transient instance with an identifier associated with existing persistent state.
Execute a query
A query expressed in Hibernate's query language
A distinct list of instances
See for implications of cache usage.
Execute a query, binding a value to a "?" parameter in the query string.
The query string
A value to be bound to a "?" placeholder
The Hibernate type of the value
A distinct list of instances
See for implications of cache usage.
Execute a query, binding an array of values to a "?" parameters in the query string.
The query string
An array of values to be bound to the "?" placeholders
An array of Hibernate types of the values
A distinct list of instances
See for implications of cache usage.
Execute a query and return the results in an interator.
The query string
An enumerator
If the query has multiple return values, values will be returned in an array of
type object[].
Entities returned as results are initialized on demand. The first SQL query returns
identifiers only. So Enumerator() is usually a less efficient way to retrieve
object than List().
Execute a query and return the results in an interator,
binding a value to a "?" parameter in the query string.
The query string
A value to be written to a "?" placeholder in the query string
The hibernate type of the value
An enumerator
If the query has multiple return values, values will be returned in an array of
type object[].
Entities returned as results are initialized on demand. The first SQL query returns
identifiers only. So Enumerator() is usually a less efficient way to retrieve
object than List().
Execute a query and return the results in an interator,
binding the values to "?"s parameters in the query string.
The query string
A list of values to be written to "?" placeholders in the query
A list of hibernate types of the values
An enumerator
If the query has multiple return values, values will be returned in an array of
type object[].
Entities returned as results are initialized on demand. The first SQL query returns
identifiers only. So Enumerator() is usually a less efficient way to retrieve
object than List().
Apply a filter to a persistent collection.
A persistent collection to filter
A filter query string
The resulting collection
A filter is a Hibernate query that may refer to this, the collection element.
Filters allow efficient access to very large lazy collections. (Executing the filter
does not initialize the collection.)
Apply a filter to a persistent collection, binding the given parameter to a "?" placeholder
A persistent collection to filter
A filter query string
A value to be written to a "?" placeholder in the query
The hibernate type of value
A collection
A filter is a Hibernate query that may refer to this, the collection element.
Filters allow efficient access to very large lazy collections. (Executing the filter
does not initialize the collection.)
Apply a filter to a persistent collection, binding the given parameters to "?" placeholders.
A persistent collection to filter
A filter query string
The values to be written to "?" placeholders in the query
The hibernate types of the values
A collection
A filter is a Hibernate query that may refer to this, the collection element.
Filters allow efficient access to very large lazy collections. (Executing the filter
does not initialize the collection.)
Return the entity name for a persistent entity
a persistent entity
the entity name
Sets the batch size of the session
An that can return a list of all the results
of all the criterias.
Delete all objects returned by the query.
The query string
Returns the number of objects deleted.
Delete all objects returned by the query.
The query string
A value to be written to a "?" placeholer in the query
The hibernate type of value.
The number of instances deleted
Delete all objects returned by the query.
The query string
A list of values to be written to "?" placeholders in the query
A list of Hibernate types of the values
The number of instances deleted
Obtain the specified lock level upon the given object.
A persistent instance
The lock level
Obtain the specified lock level upon the given object.
The Entity name.
a persistent or transient instance
the lock level
This may be used to perform a version check (), to upgrade to a pessimistic
lock (), or to simply reassociate a transient instance
with a session (). This operation cascades to associated
instances if the association is mapped with cascade="lock".
Re-read the state of the given instance from the underlying database.
A persistent instance
It is inadvisable to use this to implement long-running sessions that span many
business tasks. This method is, however, useful in certain special circumstances.
For example,
- Where a database trigger alters the object state upon insert or update
- After executing direct SQL (eg. a mass update) in the same session
- After inserting a Blob or Clob
Re-read the state of the given instance from the underlying database, with
the given LockMode.
a persistent or transient instance
the lock mode to use
It is inadvisable to use this to implement long-running sessions that span many
business tasks. This method is, however, useful in certain special circumstances.
Determine the current lock mode of the given object
A persistent instance
The current lock mode
Begin a unit of work and return the associated ITransaction object.
A transaction instance
If a new underlying transaction is required, begin the transaction. Otherwise
continue the new work in the context of the existing underlying transaction.
The class of the returned object is determined by
the property transaction_factory
Begin a transaction with the specified isolationLevel
Isolation level for the new transaction
A transaction instance having the specified isolation level
Creates a new Criteria for the entity class.
The class to Query
An ICriteria object
Creates a new Criteria for the entity class with a specific alias
The class to Query
The alias of the entity
An ICriteria object
Create a new instance of Query for the given query string
A hibernate query string
The query
Create a new instance of Query for the given collection and filter string
A persistent collection
A hibernate query
A query
Obtain an instance of for a named query string defined in the
mapping file.
The name of a query defined externally.
An from a named query string.
The query can be either in HQL or SQL format.
Create a new instance of for the given SQL query string.
a query expressed in SQL
An from the SQL string
Create a new instance of IQuery for the given SQL string.
a query expressed in SQL
a table alias that appears inside {} in the SQL string
the returned persistent class
An from the SQL string
Create a new instance of for the given SQL string.
a query expressed in SQL
an array of table aliases that appear inside {} in the SQL string
the returned persistent classes
An from the SQL string
Completely clear the session. Evict all loaded instances and cancel all pending
saves, updates and deletions. Do not close open enumerables or instances of
ScrollableResults.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Gets the session implementation.
An NHibernate implementation of the interface
This method is provided in order to get the NHibernate implementation of the session from wrapper implementions.
Implementors of the interface should return the NHibernate implementation of this method.
Starts a new Session with the given entity mode in effect. This secondary
Session inherits the connection, transaction, and other context
information from the primary Session. It doesn't need to be flushed
or closed by the developer.
The entity mode to use for the new session.
The new session
Determines at which points Hibernate automatically flushes the session.
For a readonly session, it is reasonable to set the flush mode to FlushMode.Never
at the start of the session (in order to achieve some extra performance).
Get the that created this instance.
Gets the ADO.NET connection.
Applications are responsible for calling commit/rollback upon the connection before
closing the ISession.
Is the ISession still open?
Is the ISession currently connected?
Get the current Unit of Work and return the associated ITransaction object.
The current cache mode.
Cache mode determines the manner in which this session can interact with
the second level cache.
Get the statistics for this session.
Implements allowing
it to be used by the container as an ordinary component.
However only
is implemented
Initializes a new instance of the class.
The holder.
Type of the ar root.
Open a ISession on the given connection
A connection provided by the application
A session
Note that the second-level cache will be disabled if you
supply a ADO.NET connection. NHibernate will not be able to track
any statements you might have executed in the same transaction.
Consider implementing your own .
Create database connection and open a ISession on it, specifying an interceptor
A session-scoped interceptor
A session
Open a ISession on the given connection, specifying an interceptor
A connection provided by the application
A session-scoped interceptor
A session
Note that the second-level cache will be disabled if you
supply a ADO.NET connection. NHibernate will not be able to track
any statements you might have executed in the same transaction.
Consider implementing your own .
Create a database connection and open a ISession on it
Create a new databinder.
Get the ClassMetadata associated with the given entity class
Get the CollectionMetadata associated with the named collection role
Get all ClassMetadata as a IDictionary from Type
to metadata object
Get all CollectionMetadata as a IDictionary from role name
to metadata object
Obtains the current session.
The current session.
Needed for NHibernate 1.2 from trunk
Destroy this SessionFactory and release all resources
connection pools, etc). It is the responsibility of the application
to ensure that there are no open Sessions before calling
close().
Evict all entries from the process-level cache. This method occurs outside
of any transaction; it performs an immediate "hard" remove, so does not respect
any transaction isolation semantics of the usage strategy. Use with care.
Evict an entry from the process-level cache. This method occurs outside
of any transaction; it performs an immediate "hard" remove, so does not respect
any transaction isolation semantics of the usage strategy. Use with care.
Evict all entries from the process-level cache. This method occurs outside
of any transaction; it performs an immediate "hard" remove, so does not respect
any transaction isolation semantics of the usage strategy. Use with care.
Evict an entry from the process-level cache. This method occurs outside
of any transaction; it performs an immediate "hard" remove, so does not respect
any transaction isolation semantics of the usage strategy. Use with care.
Evict any query result sets cached in the default query cache region.
Evict any query result sets cached in the named query cache region.
Obtain the definition of a filter by name.
The name of the filter for which to obtain the definition.
The filter definition.
Evict all entries from the second-level cache. This method occurs outside
of any transaction; it performs an immediate "hard" remove, so does not respect
any transaction isolation semantics of the usage strategy. Use with care.
Get a new stateless session.
Get a new stateless session for the given ADO.NET connection.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Get the used.
Get the SQL Dialect
Obtain a set of the names of all filters defined on this SessionFactory.
The set of filter names.
Gets the settings.
The settings.
This collections allows external libraries
to add their own configuration to the NHibernate session factory.
This is needed in such cases where the library is tightly coupled to NHibernate, such
as the case of NHibernate Search
Get the statistics for this session factory
Initializes a new instance of the class.
The transaction mode.
Implementors should start the
transaction on the underlying resource
Implementors should commit the
transaction on the underlying resource
Implementors should rollback the
transaction on the underlying resource
Releases unmanaged and - optionally - managed resources