java-object-diff icon indicating copy to clipboard operation
java-object-diff copied to clipboard

How to get diff of child Object ?

Open luongbaotin7777 opened this issue 5 years ago • 1 comments

Hi bro !, I'm a newbie with java-object-diff. This library is amazing. But when I new object includes a child object, it cannot get diff. Ex: TestChild testChild1 = new TestChild(); testChild1.setId(1); testChild1.setName("testchild1");

    TestChild testChild2 = new TestChild();
    testChild2.setId(2);
    testChild2.setName("testchild2");

    Test test1 = new Test();
    test1.setId(3);
    test1.setColumnName("test1");
    test1.setTestChild(testChild1);

    Test test2 = new Test();
    test2.setId(4);
    test2.setColumnName("test2");
    test2.setTestChild(testChild2);

when I compare the above object, I receive the result: id: 1->2, name:testchild1 -> testchild2, columnName: test1->test2 where id: 3->4 ( of Test object).

And I cannot know which field is changed by child object, which field is changed by the parent object.

Please help me thank you very much

luongbaotin7777 avatar Jan 13 '21 08:01 luongbaotin7777

when I get node path and put it in key Map, I receive: "/indexes[IndexDto(id=436, columnName=taskTypeGuardId, indexName=FKtkwsgk54pvwdi5bd47dk2tx6, indexType=BTREE, isUnique=null, indexSchema=miguards, isPrimary=NO, comment=)]/columnName": "new": null, "old": 435

it looks sad

luongbaotin7777 avatar Jan 13 '21 09:01 luongbaotin7777