2019独角兽企业重金招聘Python工程师标准>>>
TransactionRequiredException: No transactional EntityManager availableEntityManager执行以下方法(refresh, persist, flush, joinTransaction, remove, merge) 都需要需要事务if (transactionRequiringMethods.contains(method.getName())) {// We need a transactional target now, according to the JPA spec.// Otherwise, the operation would get accepted but remain unflushed...if (target == null) {throw new TransactionRequiredException("No transactional EntityManager available");}
}需要在方法上加上@Transactional