diff --git a/integration/jackson/src/main/java/com/blazebit/persistence/integration/jackson/EntityViewAwareObjectMapper.java b/integration/jackson/src/main/java/com/blazebit/persistence/integration/jackson/EntityViewAwareObjectMapper.java index 4a7dc58618..f4428f63ff 100644 --- a/integration/jackson/src/main/java/com/blazebit/persistence/integration/jackson/EntityViewAwareObjectMapper.java +++ b/integration/jackson/src/main/java/com/blazebit/persistence/integration/jackson/EntityViewAwareObjectMapper.java @@ -28,6 +28,7 @@ import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; +import com.fasterxml.jackson.databind.deser.AbstractDeserializer; import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier; import com.fasterxml.jackson.databind.introspect.VisibilityChecker; import com.fasterxml.jackson.databind.module.SimpleModule; @@ -51,14 +52,22 @@ public EntityViewAwareObjectMapper(final EntityViewManager entityViewManager, fi public EntityViewAwareObjectMapper(final EntityViewManager entityViewManager, final ObjectMapper objectMapper, final EntityViewIdValueAccessor entityViewIdValueAccessor) { this.entityViewManager = entityViewManager; - SimpleModule module = new SimpleModule(); + SimpleModule module = new SimpleModule("Blaze-Persistence" ); module.setDeserializerModifier(new BeanDeserializerModifier() { @Override public JsonDeserializer modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer deserializer) { - ManagedViewType view = entityViewManager.getMetamodel().managedView(beanDesc.getBeanClass()); - if (view != null) { - return new EntityViewReferenceDeserializer(entityViewManager, view, objectMapper, beanDesc.getIgnoredPropertyNames(), entityViewIdValueAccessor); + if ( deserializer instanceof AbstractDeserializer ) { + ManagedViewType view = entityViewManager.getMetamodel().managedView( beanDesc.getBeanClass() ); + if ( view != null ) { + return new EntityViewReferenceDeserializer( + entityViewManager, + view, + objectMapper, + beanDesc.getIgnoredPropertyNames(), + entityViewIdValueAccessor + ); + } } return deserializer; }