0

I have used @JsonIgnore annotation in both field and the setter in my entity to achieve the deserialization issue as mentioned in the following question.

My issue was to prevent deserialization of a particular field which had already serialized.

This is the question I posted earlier

But now we are getting the following exception due to that modification when trying to build the spring web project. But the module which we did the change builds successfully.

org.springframework.data.mapping.model.MappingException: Ambiguous mapping! Annotation JsonIgnore configured on field yyyyyy and one of its accessor methods in class XXXXXEntity!

Any comment about this is highly appreciated.

Community
  • 1
  • 1
virtualpathum
  • 753
  • 2
  • 11
  • 23

1 Answers1

0

The exception is triggered by the spring-data change that restricts the same annotation on a field and method level. However, the restriction is somehow buggy as it escapes even to the non spring data annotation like in your case. They've fixed it in more recent version, so finding a proper version should fix your issue as well. To learn more check out these threads

https://jira.spring.io/browse/DATACMNS-556, read the comments to understand the rational and the problem

the issue for fixing (from which you can pick up the proper versions)

https://jira.spring.io/browse/DATAJPA-569

Master Slave
  • 27,771
  • 4
  • 57
  • 55