Skip to content

@JsonUnwrapped fails for HibernateProxy instances #97

@jwgmeligmeyling

Description

@jwgmeligmeyling

@JsonUnwrapped fails for HibernateProxy instances. They are serialized as if the @JsonUnwrapped annotation was missing.

Work around:

Replace the object with its underlying implementation:

Hibernate.initialize(client);
this.client = (Client) ((HibernateProxy) client)
      .getHibernateLazyInitializer()
      .getImplementation();

Tested on the following dependencies:

[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.0:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.0:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.8.0:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-hibernate5:jar:2.8.0:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.8.0:compile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions