I have a Person JPA entity, and my Person has multiple addresses (OneToMany relationship from Person to Address). I want to be able to do a query for all people that have a particle zipcode but I'm not sure after looking at the querydsl documentation how to properly handle the collection.
I can access the addresses but I'm not sure what to do with them:
QPerson qPerson = QPerson.person;
personDao.findAll(qPerson.addresses._SPECIFICADDRESS_.zip.eq('73130'));
How can I get the SPECIFICADDRESS I'm looking for?
Try this
QPerson qPerson = QPerson.person;
personDao.findAll(qPerson.addresses.any().zip.eq('73130'));