Community contributed extensions

PlayMorphia annotations

In this chapter we list all annotations used in PlayMorphia application development including annotations provided by Morphia and annotations supplied by PlayMorphia only.

Morphia annotations

You can use any Morphia annotation in your PlayMorphia application. Please visit the Morphia all annotations page at Morphia site.

PlayMorphia annotations

The following annotations are scoped to play.modules.morphia.Model:

AnnotationMarkDescription
AddedModel methodMark a method to be called when an new entity has been saved
AutoTimestampModel classIndicate the model class shall be enhanced to support automatic timestamp
BatchDeletedModel methodMark a method to be called when a query of the model has been deleted
ColumnModel fieldUsed to specify a different column name mapping to the field
DeletedModel methodMark a method to be called when an entity is deleted from MongoDB
LoadedModel methodMark a method to be called when an entity has been loaded from MongoDB
NoIdModel classNotify PlayMorphia enhancer not to generate ID field for the class (as it’s parent class has ID field defined)
NoAutoTimestampModel classIndicate the model class shall NOT be enhanced to support automatic timestamp
OnAddModel methodMark a method to be called when an new entity is about to be saved to MongoDB
OnBatchDeleteModel methodMark a method to be called when a query of entities is about to be deleted from MongoDB
OnDeleteModel methodMark a method to be called when an entity is about to be deleted from MongoDB
OnLoadModel methodMark a method to be called when an entity is about to be loaded from MongoDB
OnUpdateModel methodMark a method to be called when an existing entity is about to be saved to MongoDB
UpdatedModel methodMark a method to be called when an existing entity has been saved to MongoDB

AutoTimestamp is deprecated. The model class now by default is enhanced with auto timestamp support. To revoke this enhancement, mark your model class with NoAutoTimestamp annotation

See also

  1. PlayMorphia entity lifecycle events
  2. Specify name of mapped collection and columns
  3. PlayMoprhia model inheritance
  4. Go back to PlayMorphia document home