質問

My Entity has a property,

@Embedded
@XmlTransient
private ReleaseTraits traits;

@XmlTransient
public ReleaseTraits getTraits() { 
    return traits; 
}

But RestEasy (in JBoss AS 7.1) keeps putting it to the JSON. Also, the null values are not omitted.

Any idea why and how to achieve the property to be left out?

役に立ちましたか?

解決

@JsonIgnore works. It seems that the docs is wrong about which provider is the default in JBoss AS 7.

I filed https://issues.jboss.org/browse/AS7-5604 and https://issues.jboss.org/browse/AS7-5605 to target this.

他のヒント

This related question discusses some options for configuring your JBoss deployment to use Jettison rather than Jackson for JSON marshalling: Set JSON provider at RESTEasy on JBoss 7.1.1

For the benefit of others, @XmlTransient works correctly for me in WildFly 8.0, which is using RestEasy 3.0.x.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top