JPA: update only specific fields

前端 未结 7 2035
自闭症患者
自闭症患者 2020-12-02 14:02

Is there a way for updating only some fields of an entity object using the method save from Spring Data JPA?

For examp

相关标签:
7条回答
  • 2020-12-02 14:52

    For long,int and other types; you can use the following code;

                if (srcValue == null|(src.getPropertyTypeDescriptor(pd.getName()).getType().equals(long.class) && srcValue.toString().equals("0")))
                emptyNames.add(pd.getName());
    
    0 讨论(0)
提交回复
热议问题