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
Labels

Comments

@ghost
Copy link

@ghost 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

@bartoszwalacik bartoszwalacik commented Aug 12, 2016

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

@ghost
Copy link
Author

@ghost 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

@bartoszwalacik 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
Copy link
Member

@bartoszwalacik bartoszwalacik commented Aug 28, 2016

fixed in 2.1.2

@ghost
Copy link
Author

@ghost 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

@bartoszwalacik 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

@ghost
Copy link
Author

@ghost 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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant