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

Map dot key replacement #416

Closed
rebel23 opened this Issue Aug 12, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@rebel23
Contributor

rebel23 commented Aug 12, 2016

Map fields of object snapshots containing keys with dots cannot be persisted.
It would be perfect to add possibility to set map key dot replacement ('.' <> '#dot#' for example) in Javers MongoRepository or Javers at all.

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Aug 12, 2016

Could you come up with a failing test case for this issue?

@rebel23

This comment has been minimized.

Contributor

rebel23 commented Aug 14, 2016

Hi, completely forgot about test case, sorry.
I've just added a case to JaversMongoRepositoryE2ETest, so now MongoIntegrationTest should fail on it. Unfortunately I couldn't run this test on my local machine. Please, confirm if you can reproduce the issue.
Here is the link to branch with test case in my fork: issue416

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Aug 14, 2016

ok, will check it next week (now I'm on holiday)

bartoszwalacik added a commit that referenced this issue Aug 28, 2016

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Aug 28, 2016

fixed in 2.1.2

@rebel23

This comment has been minimized.

Contributor

rebel23 commented Sep 1, 2016

It looks great) But this solution does not work for nested maps, still getting the same exception:
def version2 = new SnapshotEntity(id: 1, polymorficMap: ['key':['primitive.value':1]])
javers.commit('author', version2)
snapshots[0].getPropertyValue('polymorficMap') == ['key':['primitive.value':1]]
I've update branch in my fork with this case.

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Sep 2, 2016

true, but I don't think that JaVers will do meaningful diff for such complex structure like
Map<?,Map<String,?>.
I suggest replacing nested Map with some ValueObject class

@rebel23

This comment has been minimized.

Contributor

rebel23 commented Sep 4, 2016

You are right. Thank you for suggestion and quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment