Spring data的更新使用BeanUtils.copyProperties

常用的Spring data的更新思路:

 先查询出持久化对象,然后合并properties,再save。

        BeanUtils.copyProperties(source,targe);
        targe.setUpdateUserId(userId);
        targe.setUpdateUserName(userName);
        targe.setUpdateTime(new Date());
        注意:用的是package org.springframework.beans的工具类,注意复制顺序
             2.当source的字段是Null时的处理方法

你可能感兴趣的:(Spring,data)