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