jeudi 19 juillet 2018

Is it possible to do mongo find with Generic Class

I am using mongodb and I was wondering how is possible to have a generic class for the service.

For example in my case I have:

List<Mobile> res = this.mongoTemplate.find(query, Mobile.class);

and

List<Job> res = this.mongoTemplate.find(query, Job.class);

This makes me have the exact same method for different classes.





Aucun commentaire:

Enregistrer un commentaire