5.3.7 SessionFactory

This class is used to generate and manage sessions. A Session provides a context for database transactions and operations. Each independent user should have its own session.

openSession(Object mappings, Function(Object error, Session session) callback);

Open a database session object. Table mappings are validated at the beginning of the session. Resources required for sessions are allocated in advance; if those resources are not available, the method returns an error in the callback.

Array getOpenSessions();

Get all open sessions that have been created by this SessionFactory.

close(Function(Error err));

Close the connection to the database. This ensures proper disconnection. The function passed in is called when the close operation is complete.