Event Handling In Cfc - Adobe 38043740 - ColdFusion Standard - Mac Development Manual

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion ORM
In multiple data source scenarios supported in ColdFusion 9 Update 1, there are multiple sessions (one for each data
source) in the same request. For all entity functions, the appropriate sessions are used transparently.
ColdFusion exposes a few methods to let CFML developers work with the Hibernate sessions directly. ORM session-
related functions also take optional data source argument. If you do not specify a data source, the default data source
specified for ORM is used. The methods are as follows:
ORMGetSession()
Returns the current ORM session. That is, the Hibernate Session associated with the data source specified in the
application. This returns the underlying Hibernate Session that can be used to call the API, which otherwise is not
exposed by ColdFusion.
For information on Session API, see www.hibernate.org/hib_docs/v3/api/org/hibernate/Session.html.
ORMCloseSession()
Closes the current ORM session associated with the data source specified in the application.
ORMFlush()
Flushes the current ORM session associated with the data source specified in the application. ORMFlush flushes all the
pending CRUD operations in that request.
ORMClearSession()
ORMClearSession removes all the entities that are loaded or created in the session. This clears the first level cache and
removes the objects that are not yet saved to the database.
ORMGetSessionFactory()
returns the underlying Hibernate SessionFactory object. For information on Session API,
ORMGetSessionFactory
see
www.hibernate.org/hib_docs/v3/api/org/hibernate/SessionFactory.html

Event Handling in CFC

ORM provides callbacks to the event listeners for all the persistence events like
events can be used for data validations or transformation or for some generic functions such as auditing. These events
can be handled at two levels in ColdFusion ORM:
• In a persistent CFC
• Using an event handler CFC
To enable event handling for an application, define the following setting:
By default, this flag is disabled. If you do not specify this flag while the event handler CFC is defined, the flag is
considered as enabled.
Last updated 1/20/2012
,
,
,
Load
Insert
Update
ormsettings.eventhandling
596
. These
Delete
= "
true"

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents