您的位置:首页 > 移动开发 > Objective-C

出现org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient

2017-05-05 13:56 603 查看


出现的问题就是org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: com.vvv.entity.Order; nested exception is org.hibernate.TransientObjectException:
object references an unsaved transient instance - save the transient instance before flushing: com.vvv.entity.Order,当你保存一个更改的表时,首先保存这个表的外键所在的表。

就像我遇到的这个错误一样  ,想着只保存订单条目,而忘记保存订单表,就会出现这个错误。所以要多注意外键做造成的错误。
orderService.add(order);       orderItemService.add(orderItem);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐