spring boot debug 记录之BeanUtils.copyProperties 使用顺序

记录下今天早上spring boot debug记录

问题描述:订单表和订单详情表关联,在写入订单表的时候,总是提示orderId为空

错误提示:

org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save(): com.example.sell.dataobject.OrderMaster; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.example.sell.dataobject.OrderMaster

 如上图,我是找的17年的慕客项目,我看他那么写的,我也这么写了,上图可以看出来,是先set,然后copy,结果copy后,orderID没了,然后灵机一动,把copy往上挪一步,然后就成功了

 新手,没具体看copy的实现,就错论错~

原文地址:https://www.cnblogs.com/jueshilaozhongyi/p/13063697.html