Hello devs,
This is my sample project to prove my idea of a generic persistence layer using spring mongodb repositories.
Currently I have been playing with the last version of Spring 4 and MongoDB using Spring MongoDB Repositories. I just had one issue about it. I need to use a different MongoDB Repository interface for each domain type, for each data value object that I need to store. Could it be easier to say to the persistence layer just save an object, no matter what type is it?
I was thinking if it could be possible to create a generic version of that persistence layer, so that I can register all domain types (data types) with the MongoDb repositories and the persistence layer would manage to find the right way to work with each type.
I implemented a sample project to prove that YES it is possible and I think it could be quite easy to maintain and expand its functionality.
The code is in Github in the Generic Spring MongoDB Persistence Layer repository. In the Integration Tests you can see how it works. All documentation is in JavaDocs in the Persistence interface.
My only question now is how this would evolve and mature in a real world project. I hope someday I have this answer. ;-)
I hope it helps.
Posted by Marc Andreu.
No comments:
Post a Comment