(Quick Reference)

Purpose

Allows switching which database to use to persist for the domain class for the scope of the current session (connection).

Examples

Book.useDatabase("non-fiction")

Description

The useDatabase method allows switching, at runtime, the database used persist and retrieve domain classes. The DB property will return the current database being used. Note that the method switches the database used for the scope of the current session/connection (ie. it is not permanent). If you wish to permanently change the database used then you need to configure the mapping of the domain class.