Ignore missing entities when lazy loading is enabled, if (newly added) Feature.WRITE_MISSING_ENTITIES_AS_NULL
is enabled
#125
Milestone
Feature.WRITE_MISSING_ENTITIES_AS_NULL
is enabled
#125
I have a fairly odd JPA mapping where the owning entity has a "potential" identifier to another entity in
otherIndex
:This mapping allows for
SomeOther
to perhaps exist in the database and if it does, it's properly serialized (when usingdisable(Feature.FORCE_LAZY_LOADING)
). Sometimes there's no record withotherIndex
inSomeOther
.We have two serializers: one for Spring MVC with lazy loading disabled:
and one for serializing to JSON for Elasticsearch indexing with lazy loading enabled:
The MVC serializer behaves as expected, but the
FORCE_LAZY_LOADING
on ES serializer dies when there's no record of "referenced" entity with:I'd prefer if this behavior was configurable and would default to
null
whenEntityNotFoundException
is thrown incom.fasterxml.jackson.datatype.hibernate4.HibernateProxySerializer#findProxied
method.Could we have something along the lines of
.enable(WRITE_MISSING_ENTITIES_AS_NULL)
?The text was updated successfully, but these errors were encountered: