This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 1012
    
    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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to compare Lists in JPA
 
Similar Threads
Problem with JPA Embeddable class field in Embedded
java annotation & lazy loading
How to query a value typed object
Hibernate
Spring Data JPA