I don't want to serialise any lazy
object and tried a lot to get rid of this but no luck. Used
mapper.registerModule(new Hibernate5Module())
but this seems like loading any lazy object which i don't want. Have tried many possible ways which i got in net but no luck.
Only thing working for me is @JsonProperty(access = Access.WRITE_ONLY)
but again it won't deserialise my data back which I don't want and also in some other condition I need this data back. I mean while I need this object on loaded data I need this object back.
I use:
- Spring boot
- Hibernate 5
Mapping in POJO
:
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@Fetch(value = FetchMode.JOIN)
@JsonProperty(value = "parameterValues")
@JsonInclude(value=Include.NON_EMPTY, content=Include.NON_NULL)
private Set<FunctionalAreaParameterValueMaster> masterParameterValues;
in controller:
return new ResponseEntity<Data>(data, HttpStatus.OK);