Question

When add aws-java-sdk to pom.xml, my existing @JsonIgnore annotation doesn't work anymore. But when I delete Amazon SDK (aws-java-sdk) from the pom file, JsonIgnore works well. It is quite weird situation and I don't know the reason.

Jackson version is 1.9.13 and Amazon SDK version is 1.6.12.

I need to use @JsonIgnore to prevent circular reference on Hibernate models. I also need to use Amazon SDK to work with Amazon S3.

Any help would be appreciated.

Edit:

Class Car  {
    private String title;
    @JsonIgnore
    private Model model;
    …
}

Class Model  {
    @ManyToOne
    @JoinColumn(name="manufacturer_id", referencedColumnName="id")
    private Manufacturer manufacturer;
    …
}

Class Manufacturer {
    @OneToMany(mappedBy = "manufacturer")
    @JsonIgnore
    private List<Model> models;
    …
}
Was it helpful?

Solution

@Matt B is right... The AWS SDK has a dependency on jackson-annotations, jackson-databind, and jackson-core. The use of @JsonIgnore changed after Jackson v1.9: http://fasterxml.github.io/jackson-annotations/javadoc/2.0.2/com/fasterxml/jackson/annotation/JsonIgnore.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top