Spring -data: how to request a subtype using specification

I have three of these types:

@Entity @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "TYPE") public abstract class A { // fields, getters, setters } @Entity @DiscriminatorValue("B") public class B extends A { // fields, getters, setters } @Entity @DiscriminatorValue("C") public class C extends A { // fields, getters, setters } 

I also have a repository:

 @Repository public interface ADao extends JpaRepository<A, Long>, JpaSpecificationExecutor<A> { } 

In this repository, I have a method

 List<A> findAll(Specification<A> s) 

which is defined in the JpaSpecificationExecutor.

My question is: how can I make a request using the specification in a field declared only in B?

Thanks in advance, Jerome

+6
source share

Source: https://habr.com/ru/post/959234/


All Articles