@SpringBootApplication
public class JpqlSampleApplication {
public static void main(String[] args) {
SpringApplication.run(JpqlSampleApplication.class, args);
}
@PersistenceContext
EntityManager em;
@Transactional
@EventListener(ApplicationReadyEvent.class)
public void o(){
Member member = new Member();
member.setUsername("memberA");
}
}
스프링 부트 Main 내부에서의 JPA 직접 실행.
Sample code를 따라 연습할 때 유용