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

xiaoxiao2021-02-28  103

出现的问题就是 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);
转载请注明原文地址: https://www.6miu.com/read-23906.html

最新回复(0)