JPA NativeQuery 사용법


JPA NativeQuery 사용법

JPA NativeQuery SQL을 직접 정의하여 사용하는 방식 원하는 조회값이 findBy 등의 함수로 불가능한 경우에 사용 @REPOSITORY public interface CandleRepository extends JpaRepository<Candle, String> { @Query(value = "select id" + ", high_price as highPrice" + ", low_price as lowPrice" + ", next_high_price as nextHighPrice" + ", next_low_price as nextLowPrice" + ", range as range" + ", target as target" + ", case when high_price > target then trade_price/target else '0' end as earnings" + "FROM (SELECT id" + ", high_price" + ", low_price"...


#JPA #NativeQuery #Query #SPRING

원문링크 : JPA NativeQuery 사용법