I am using SpringData for mongoDb and have defined marker repository interfaces for my entities. All repositories extend a custom parent repository. I need to perform validation on my entities before saving them.
Since repository implementations are proxied at runtime I don't have a handle to write validate method in each repository. How do I ensure validation is invoked on each entity prior to save?
I have other requirements too where few child repositories may choose to override behavior of some methods.
- Auto generating GUID for all entities that are being saved. Logic to generate the id resides with the repository.