0

I have a basic JPA mapping with a superclass containing a list.

How can I select all List row entries from the database for a specific person?

class Person {
    @Id
    int id;

    @OneToMany
    List<Payment> payments;
}

//SELECT <all payments> from Person p WHERE p.id = 1 
4

1 回答 1

1

You can simply do SELECT person.payments FROM Person person JOIN person.payments WHERE person.id = ?.

You would cast the return list() to a List<Payment>

于 2013-10-06T02:41:04.800 回答