Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array of ValueObjects diff issue #207

Closed
floresek opened this issue Sep 25, 2015 · 5 comments
Closed

Array of ValueObjects diff issue #207

floresek opened this issue Sep 25, 2015 · 5 comments
Labels

Comments

@floresek
Copy link

@floresek floresek commented Sep 25, 2015

Hi again.

I'd like to report an diff isue.

class Master {
    @Id
    String id;

    Detail[] array;

    public Master(String id) {
        this.id = id;
    }

}

@ValueObject
class Detail {
    String data;

    public Detail(String data) {
        this.data = data;
    }
}

        ...
        Master master = new Master("3");
        master.array = new Detail[] { new Detail("details-array")};
        javers.commit("anonymous", master);
        javers.commit("anonymous", master);
        javers.commit("anonymous", master);
        List<Change> changes = javers
                .findChanges(QueryBuilder.byInstanceId("3", Master.class)
                        .withNewObjectChanges(true)
                        .build());
        String changeLog = javers.processChangeList(changes, getChangeLogger());
        ...

Second and third commit save Master snapshot with 'array' property changed (although no change occurred).
processChangeList traces only one initial change.

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Sep 30, 2015

if you are using sql repository, this issue could be fixed in fresh 1.3.10, could you check this?

Bug you've posted - #206 - was affecting snapshots comparision

@floresek
Copy link
Author

@floresek floresek commented Oct 1, 2015

The problem still exists in new version.

I ran the test with 1.3.10 javers version and java: jdk1.7.0_79 (64 bit)

Below I attached exported rows from jv_snapshot, which were created during commits:

[{
  "snapshot_pk": 1400,
  "type": "INITIAL",
  "state": "{  "data": "details-array"}",
  "changed_properties": "[  "data"]",
  "global_id_fk": 1201,
  "commit_fk": 1500
 },
 {
  "snapshot_pk": 1401,
  "type": "INITIAL",
  "state": "{  "id": "3",  "array": [    {      "valueObject": "javers.Detail",      "ownerId": {        "entity": "javers.Master",        "cdoId": "3"      },      "fragment": "array/0"    }  ]}",
  "changed_properties": "[  "id",  "array"]",
  "global_id_fk": 1200,
  "commit_fk": 1500
 },
 {
  "snapshot_pk": 1402,
  "type": "UPDATE",
  "state": "{  "id": "3",  "array": [    {      "valueObject": "javers.Detail",      "ownerId": {        "entity": "javers.Master",        "cdoId": "3"      },      "fragment": "array/0"    }  ]}",
  "changed_properties": "[  "array"]",
  "global_id_fk": 1200,
  "commit_fk": 1501
 },
 {
  "snapshot_pk": 1403,
  "type": "UPDATE",
  "state": "{  "id": "3",  "array": [    {      "valueObject": "javers.Detail",      "ownerId": {        "entity": "javers.Master",        "cdoId": "3"      },      "fragment": "array/0"    }  ]}",
  "changed_properties": "[  "array"]",
  "global_id_fk": 1200,
  "commit_fk": 1502
 }
]
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Oct 1, 2015

okay, will take a look at this soon

bartoszwalacik added a commit that referenced this issue Oct 9, 2015
fixed issue in arrays dehydration and comparing deserialized primitive arrays
bartoszwalacik added a commit that referenced this issue Oct 9, 2015
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Oct 9, 2015

fix is on its way to Maven Central ...

@bartoszwalacik bartoszwalacik added the fixed label Oct 9, 2015
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Oct 9, 2015

fixed in 1.3.13 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants