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
:
Annotation | Mark | Description |
---|---|---|
Added | Model method | Mark a method to be called when an new entity has been saved |
BatchDeleted | Model method | Mark a method to be called when a query of the model has been deleted |
Column | Model field | Used to specify a different column name mapping to the field |
Deleted | Model method | Mark a method to be called when an entity is deleted from MongoDB |
Loaded | Model method | Mark a method to be called when an entity has been loaded from MongoDB |
NoId | Model class | Notify PlayMorphia enhancer not to generate ID field for the class (as it’s parent class has ID field defined) |
NoAutoTimestamp | Model class | Indicate the model class shall NOT be enhanced to support automatic timestamp |
OnAdd | Model method | Mark a method to be called when an new entity is about to be saved to MongoDB |
OnBatchDelete | Model method | Mark a method to be called when a query of entities is about to be deleted from MongoDB |
OnDelete | Model method | Mark a method to be called when an entity is about to be deleted from MongoDB |
OnLoad | Model method | Mark a method to be called when an entity is about to be loaded from MongoDB |
OnUpdate | Model method | Mark a method to be called when an existing entity is about to be saved to MongoDB |
Updated | Model method | Mark 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
annotationNoAutoTimestamp