문제

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