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

Map dot key replacement #416

Closed
ghost opened this issue Aug 12, 2016 · 7 comments
Closed

Map dot key replacement #416

ghost opened this issue Aug 12, 2016 · 7 comments

Comments

@ghost
Copy link

ghost 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
Copy link
Member

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

@ghost
Copy link
Author

ghost 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
Copy link
Member

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

@bartoszwalacik
Copy link
Member

fixed in 2.1.2

@ghost
Copy link
Author

ghost 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
Copy link
Member

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

@ghost
Copy link
Author

ghost 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
Projects
None yet
Development

No branches or pull requests

1 participant