mardi 14 avril 2015

Spring repository interface: query methods by type

I wonder if it is possible to specify a specific subtype with springs' query methods.


For example, if there is a MailUser and ChatUser, both extend User with InheritanceType.SINGLE_TABLE - can I find all MailUsers with the PersonRepository?


Or can I find all Users excluding all MailUsers in a scenario where multiple classes extend User?



public interface PersonRepository extends Repository<User, Long> {

List<Person> findByEmailAddressAndLastname(EmailAddress emailAddress, String lastname);
...
}

Aucun commentaire:

Enregistrer un commentaire