# JPA 쿼리 (Spring Boot) > JPA 쿼리: 메서드 이름 기반 파생, JPQL을 사용한 @Query, 네이티브 쿼리, 페이지네이션, 정렬 - 30 면접 질문 - Mid-Level - [면접 질문: Spring Boot](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions.md) ## 1. JPQL이란 무엇인가요? **답변** JPQL(Java Persistence Query Language)은 데이터베이스 테이블이 아닌 JPA 엔티티를 조회하는 객체 지향 언어입니다. 네이티브 SQL과 달리 JPQL은 클래스 이름과 프로퍼티 이름을 사용하므로 객체 추상화를 유지하고 서로 다른 데이터베이스 시스템 간의 이식성을 높입니다. 특정 SQL 기능이 필요하지 않다면 기본적으로 JPQL을 사용하는 것이 좋습니다. ## 2. 사용자 정의 JPQL 또는 SQL 쿼리를 실행할 수 있는 어노테이션은 무엇인가요? **답변** @Query 어노테이션을 사용하면 Spring Data JPA 리포지토리 안에서 직접 사용자 정의 쿼리를 정의할 수 있습니다. 기본적으로 JPQL을 작성할 수 있으며, nativeQuery 속성을 true로 설정하면 네이티브 SQL도 작성할 수 있습니다. 이 어노테이션은 메서드 이름에서 파생되는 query method보다 더 많은 유연성을 제공하며, 특히 join이나 서브쿼리가 포함된 복잡한 쿼리에 유용합니다. ## 3. 메서드 매개변수를 @Query에 어떻게 바인딩하나요? **답변** @Param 어노테이션을 사용하면 @Query 쿼리에서 사용하는 매개변수에 명시적으로 이름을 지정할 수 있습니다. 이 방식은 인덱스 위치를 사용하는 것보다 가독성이 높고 견고하며, 특히 코드 리팩터링 시 유용합니다. 이 어노테이션은 JPQL의 명명된 매개변수에 필수이며, 유지보수성을 높이기 위해 네이티브 SQL 쿼리에서도 권장됩니다. ## 27개 추가 질문 이용 가능 - JPQL에서 결과를 필터링할 수 있는 절은 무엇인가요? - JPQL과 네이티브 SQL의 주요 차이점은 무엇인가요? 무료로 가입하기: https://sharpskill.dev/ko/login ## 기타 Spring Boot 면접 주제 - [Spring Core - IoC & DI](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-core-ioc-di.md): 22개 질문, Junior - [Spring Boot Auto-Configuration](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-boot-auto-configuration.md): 20개 질문, Junior - [Spring Boot Starters](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-boot-starters.md): 18개 질문, Junior - [Application Properties & YAML](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/application-properties-yml.md): 16개 질문, Junior - [SLF4J 및 Logback을 사용한 로깅](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/logging.md): 20개 질문, Junior - [Spring Boot DevTools](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-boot-devtools.md): 15개 질문, Junior - [Spring MVC Basics](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-mvc-basics.md): 20개 질문, Mid-Level - [Spring REST Controllers](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-rest-controllers.md): 20개 질문, Mid-Level - [Request & Response Handling](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/request-response-handling.md): 20개 질문, Mid-Level - [예외 처리](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/exception-handling.md): 25개 질문, Mid-Level - [Bean Validation](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/bean-validation.md): 25개 질문, Mid-Level - [Spring Data JPA 기초](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-data-jpa-basics.md): 25개 질문, Mid-Level - [JPA 엔티티 및 관계](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/jpa-entities-relationships.md): 30개 질문, Mid-Level - [Spring Data Repositories](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-data-repositories.md): 25개 질문, Mid-Level - [Spring Security 기초](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-security-basics.md): 25개 질문, Mid-Level - [Spring Boot Actuator](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-boot-actuator.md): 20개 질문, Mid-Level - [JUnit과 Mockito를 사용한 단위 테스트](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/testing-junit-mockito.md): 30개 질문, Mid-Level - [Spring Boot 테스트](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-boot-testing.md): 30개 질문, Mid-Level - [Profiles와 Environment](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/profiles-environment.md): 20개 질문, Mid-Level - [RestTemplate 및 WebClient](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/resttemplate-webclient.md): 24개 질문, Mid-Level - [Async와 스케줄링](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/async-scheduling.md): 25개 질문, Mid-Level - [Spring을 사용한 캐싱](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/caching.md): 25개 질문, Mid-Level - [Spring WebFlux (리액티브)](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-webflux.md): 25개 질문, Mid-Level - [Spring 트랜잭션](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/transactions.md): 30개 질문, Senior - [고급 인증 및 인가](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/authentication-authorization.md): 30개 질문, Senior - [JWT 및 스테이트리스 보안](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/jwt-stateless-security.md): 20개 질문, Senior - [OAuth2와 Authorization Server](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/oauth2-authorization-server.md): 20개 질문, Senior - [Spring Boot와 Docker](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-boot-docker.md): 19개 질문, Senior - [Spring을 활용한 마이크로서비스](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/microservices-basics.md): 25개 질문, Senior - [Spring Cloud Config](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/spring-cloud-config.md): 19개 질문, Senior - [성능 최적화](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/performance-optimization.md): 30개 질문, Senior - [GraalVM Native Images](https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/graalvm-native-images.md): 20개 질문, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ko/technologies/spring-boot/interview-questions/jpa-queries