PayService { public void updateNative(Long id, String tradeNo) { EntityManager em = entityManagerFactory.createEntityManager(); EntityTransaction tx = em.getTransaction(); tx.begin(); Pay pay = em.find(Pay.class, id); pay.changeTradeNo(tradeNo); tx.commit(); }  void updateNative(Long id, String tradeNo); @Transactional void update(Long id, String tradeNo);  }
@Test public void 엔티티매니저로_확인() { Pay pay = payRepository.save(new Pay("test1", 100)); String updateTradeNo = "test2"; payService.updateNative(pay.getId(), updateTradeNo); Pay saved = payRepository.findAll().get(0); assertThat(saved.getTradeNo()).isEqualTo(updateTradeNo); }