Issue
I have a DB with a single partition key, say prop1
. So i know i can do a findByProp1
and also a findAll
. Can i do a findByProp1andProp2andProp3
etc where prop2 ,prop3
are not specified as partition keys but can be found in every item in a collection ?
Solution
Yes you can make use of the aforementioned method of searching for tuples in db on the basis of multiple properties. Spring data specification defines that you can search with multiple keys given they exist in the Model of the table you are searching in. methods are defined in the DAO as
List<Model> findByProp1AndProp2(String prop1, String prop2)
Assuming both prop1 and prop2 are of String type, although they can be of any compatible datatype as defined in the Model.
Answered By - Dhananjay Gupta
Answer Checked By - Mary Flores (JavaFixing Volunteer)