[spring] repository 에서 Entity가 아닌 pojo 매핑 (interface , dao 사용)


[spring] repository 에서 Entity가 아닌 pojo 매핑 (interface , dao 사용)

interface native query가 아닐때도 interface로 매핑이 가능하다. <TestRepository > @Repository public interface TestRepository extends JpaRepository<TestEntity, Long> { //<Interface 쓰는 방식> @Query("SELECT " + "a.column1 as column1, " + "a.column2 as column2, " + "a.column3 as column3" + "FROM TestEntity AS a " + "WHERE a.column1= :value ") List<TestInterface> testWithInterface(@Param(value = "value") int value); } <TestInterface> public interface TestInterface{ int getColumn1(); String getColumn2(); String getC...


#dao #entity #getInterface #interface #mappring #pojo #repository #toIntExact

원문링크 : [spring] repository 에서 Entity가 아닌 pojo 매핑 (interface , dao 사용)