Spefication
스펙
스펙
Public interface Speficiation<T> {
public boolean isSatisfiedBy(T agg)
}Spring Data JPA
public interface Specification<T> extends Serializable {
// not,where,and,or 메서드 생략
@Nullable
Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb);
}JPA 정적 메타 모델
정적 메타 모델의 용도:
스펙 조합
스펙 인터페이스는 and와 or 메서드 제공
and와 or 메서드 제공 and()
and()or()
or()not()
not()where()
where()리포지터리/DAO 에서 스펙 사용하기
예시
스펙 조합을 위한 스펙 빌더 클래스
Reference
Last updated