ORMCloseSession()

edit

Closes the current ORM session.

Requires Extension: Hibernate ORM Engine Extension

ORMCloseSession( datasource=string );

Returns: void

Argument Description
datasource
string, optional
edit

datasource used for the session, if nor defined the datasource defined in application.cfc/cfapplication is used.

Usage Notes

edit

Closes the current ORM session and releases its database connection back to the pool. All entities in the session become detached.

A new session is automatically created on the next ORM operation. The session is also automatically closed at the end of every request regardless of whether you call this function.

In most cases you don't need to call this — it's mainly useful for explicitly releasing resources in long-running requests.

See ORM - Sessions and Transactions for session lifecycle details.

Examples

edit
// Close the default datasource session
ormCloseSession();
// Close a specific datasource session
ormCloseSession( "inventoryDB" );

See also