✔ 깃허브 소스코드
✔ Udemy 강의영상
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = JpaApplication.class)
public class NativeQueriesTests {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private EntityManager entityManager;
@Test
public void findAllWithNativeQuery() {
Query query = entityManager.createNativeQuery("SELECT * FROM courses", Course.class);
List<?> courses = query.getResultList();
logger.info(String.format("SELECT * FROM courses -> %s", courses));
}
}