ayengin
ayengin

Reputation: 1596

Jackson library ignoring properties

Jackson @JsonIgnoreProperties not ignoring possibleTargets ,but ignoring owner and lemf .How i can ignore lists.

@JsonIgnoreProperties( {"owner","lemf"," possibleTargets"} )
@Entity
public class Warrant extends Nameable {

    @LazyCollection(LazyCollectionOption.FALSE)
    @OneToMany(mappedBy ="warrant",targetEntity = com.endersys.lims.model.Target.class)
    private List<Target> possibleTargets;

Output:

[{"status":"SCHEDULED","startDate":1320962400000,"endDate":1320962400000,"caseId":"1","possibleTargets":[],"name":"warrant_1","description":"decription","identity":"warrant_1","version":1,"systemId":1,"active":true}]

Upvotes: 2

Views: 3142

Answers (2)

li_developer
li_developer

Reputation: 179

Use Jackson version 2.4 it works perfectly.

This is how you can implemented:

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties({"id"})

In this developerWork post I found an example to implement Jackson v2.4 all the code and library is available.

Upvotes: 0

ayengin
ayengin

Reputation: 1596

I was also have problem lazyload because jackson was trying to serialize ignored fields.I have find a post related to this.Using jackson 1.9 problem solved ,I use @JsonIgnore but @JsonIgnoreProperties still not working on onetomany relations.

Upvotes: 2

Related Questions