如何在api网关中实现数据库事务?
@Transactional
@RequestMapping(value = UserConstants.USERS_PATH, method = RequestMethod.POST)
public void save(@RequestBody User user) {
//save two model
UserEntity ue = userService.save(user.reverseEntity());
VideoEntity ve = videoService.save(user.getVideo().reverseEntity());
//service load by eureka + feign
}
我希望在一次交易中保存两个具有不同服务的模型。