(Quick Reference)

cassandraMapping

The cassandraMapping static property defines the characteristics for how objects of the class as well as their indexes and counters are stored in Cassandra column families. At a minimum it must contain an entry specifying which property (or properties) is to be used for generating row keys for the object. This entry is typically named primaryKey, for example:

static cassandraMapping = [
         primaryKey: "uuid"
]

Alternatively, you can specify unindexedPrimaryKey rather than indexedPrimaryKey. This will prevent you from being able to retrieve all objects using the list() function, but may be desireable when you are storing a very large number of objects since all of the index values are stored in a single row.

The possible cassandra mapping properties are listed in the following table.

NameDescription
clusterName of the cluster in which these objects are to be stored. The default value is determined by the Cassandra client configuration.
countersA list of counter definitions
columnFamilyThe name of the primary column family in which to store these objects. Defaults to the simple class name
expandoMapThe name of a map property to be used for storing expando properties in this object
explicitIndexesA list of index definitions
keySpaceThe key space to be used for storing these objects. The default value is determined by the Cassandra client configuration.
primaryKeyThe name of the property to use for the row key, or an array of property names if a composite key is desired
secondaryIndexesA list of secondary index definitions. These must set up declared in the Cassandra schema as well.
timeToLiveEither an integer value, which specifies the time-to-live (in seconds) for the entire object and its indexes, or a map that specifies the time-to-live for individual properties.
unindexedPrimaryKeyAlternative to specifying a primaryKey for very large collections of objects where the list() method isn't needed.