Is it possible to search based on some param value of a DBRef object in spring data.
eg. say we have two objects, Car, and Company as shown
Class Car {
@Id
String id;
String model;
@DBRef
Company company;
}
Class Company {
@Id
String id;
String name;
}
Can I write a query to fetch all car's of Hyundai company like this,
Query queryForCars = new Query(Criteria.where("company.name").is("Hyundai")), Car.class)
It works fine for non referenced objects, but for referenced object it's working in my case.
Thanks for your help.