QuerydslJpaRepository가 depreacted 됬는데요
488
작성한 질문수 3
QuerydslJpaPredicateExecutor 를 쓰라고 해서
이것으로 바꿔봤는데요 JpaRepository 의 모든
메소드를 오버라이딩 해야 하는식으로 되버려서
어떻게 적용하면 좋을지 질문드려 봅니다.
답변 3
0
아 커스텀 베이스 리파지토리까지 만들어 쓰시는 경우로군요. 이 경우는 좀 더 복잡한데...
https://stackoverflow.com/questions/53083047/replacing-deprecated-querydsljparepository-with-querydsljpapredicateexecutor-fai
여기에 예제 코드가 나와있으니 참고하세요.
0
안녕하세요. 답변 감사드립니다.
예제에 있던 MyRepository 를
@NoRepositoryBean
public interface MyRepository<T, ID extends Serializable> extends JpaRepository<T, ID>, QuerydslPredicateExecutor<T> {
boolean contains(T entity);
}
위와 같이 바꿨습니다.
그리고 이를 사용하는 SimpleMyRepository 에서
public class SimpleMyRepository<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements MyRepository<T, ID> {
private EntityManager entityManager;
public SimpleMyRepository(JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager, EntityManager entityManager1) {
super(entityInformation, entityManager);
this.entityManager = entityManager1;
}
@Override
public boolean contains(T entity) {
return entityManager.contains(entity);
}
}
위와 같이 바꾸려는데 JpaRepository는 구현체인 SimpleJpaRepository 가 있는 반면,
QuerydslPredicateExecutor 은 구현체가 없어서

위 함수들을 재정의 해줘야 하는것으로 보입니다.
구현체인 QuerydslJpaPredicateExecutor 를 SimpleMyRepository 에서 상속해야 할 것 같은데
하나만 상속이 되니 어떻게 해야 할지 잘 모르겠습니다.
0
QuerydslPredicateExecutor 이 인터페이스를 JpaRepository를 extends한 인터페이스에 추가로 extends 해주시면 finallAll(Predicate)등, QueryDSL과 연동한 구현체를 제공해 줍니다.
MyRepo extends JpaRpository<E, K>, QuerydslPredicateExecutor<E>
이런식으로요.
spring boot 2.7.13-SNAPSHOT trace 소문자 로그 안나옴
0
532
1
<스프링 데이터 Common: 기본 리포지토리 커스터마이징> 에 대한 질문
0
392
1
comment table에서 저장될떄 왜 id값이 2부터저장이되는건가요?
0
406
1
@EnableJpaRepositories 설정을 스프링부트가 어디에서 자동설정하나요?
0
450
0
PersistenceContext 관련 질문드립니다.
0
334
1
지금(Eager), 나중에(Lazy)의 의미를 모르겠습니다
0
338
1
transaction 구간이 길어질 경우의 처리방법 문의드립니다.
0
905
1
docker postgres
0
291
1
Multiple DataSource 사용 시 transaction 관련 질문 드립니다.
0
2907
1
entity 중 null이 아닌 필드만 update 할 방법이 있을까요?
0
1190
1
Eager 모드일 경우, join을 inner join으로 바꾸는 법이 있을까요?
0
385
1
엔티티를 상속받는 DTO가 일반적인가요?
1
1847
1
커스텀 타입 클래스를 String 타입 처럼 이용해 쿼리하는 방법에 대해 질문하고 싶습니다.
0
339
1
연관관계 매핑 어떤식으로 해야될지 감이 안잡힙니다.
0
566
4
EntityManager 주입시 Annotation관련 질문드립니다.
0
565
1
클래스 기반 프로젝션 사용 관련 질문
0
560
1
save 메서드 질문드립니다.
0
258
1
복잡한 통계쿼리도 JPA로 가능한가요?
2
5592
1
find 와 get의 차이가 무엇인가요?
0
890
1
실무에서 JPA 할 때 FK로 개발할때 연관관계를 꼭 맺어주어야 하나요?
0
998
1
\dt Did not find any relations.
0
478
1
소스코드는 어디서 볼 수 있을까요?
1
282
1
table 생성과 select 문에 대한 질문
0
170
1
스프링 데이터 RepositoryTest 관련 질문
0
2168
2





