سؤال

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