blob: 77862cb935e4232885f1b6af4c7b8ae0ab46e0d4 [file] [log] [blame]
===== Purpose
Allows switching which collection to use to persist for the domain class for the scope of the current session (connection).
===== Examples
[source,groovy]
----
Book.useCollection("non-fiction")
----
===== Description
The `useCollection` method allows switching, at runtime, the collection used persist and retrieve domain classes. The `collectionName` property will return the current collection being used. Note that the method switches the collection used for the scope of the current session/connection (ie. it is not permanent). If you wish to permanently change the collection used then you need to configure the mapping of the domain class.