GeeCON Prague 2014*
The moose likes Object Relational Mapping and the fly likes How to compare Lists in JPA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to compare Lists in JPA" Watch "How to compare Lists in JPA" New topic
Author

How to compare Lists in JPA

Aleks Eustace
Greenhorn

Joined: Jun 20, 2013
Posts: 6
Please help to create JPA query.
There is Person class with field Address.




And I have input parameter List<Address> requiredAddresses.
I have to find persons having at least one address from list requiredAddresses.



Such request doesnt work.
Please advise right solution.
Aleks Eustace
Greenhorn

Joined: Jun 20, 2013
Posts: 6
Answer
http://stackoverflow.com/questions/1976422/how-to-query-a-property-of-type-liststringin-jpa
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1025
    
    5


This code was never going to work because the Person class does not have an instance member called addresses, it is called address.
Aleks Eustace
Greenhorn

Joined: Jun 20, 2013
Posts: 6
Thanks.
 
GeeCON Prague 2014
 
subject: How to compare Lists in JPA