jaxbmoxytransient

How to tell jaxb(moxy) to serialise a @Transit field?


I have a field @Transient parameter which I want my ORM to ignore, however I do want moxy to serialise it. I tried using @XmlElement but still does not work (parameter is missing from the json).

@Transient
@XmlElement
private boolean isReleasedFromCustoms;

and

public boolean isReleasedFromCustoms() {

    boolean isReleased = true;

    for (int i = 0; isReleased && i < this.products.size(); i++) {
        isReleased = (this.products.get(i).getCustomsStatus() % 10) == 0;
    }

    return isReleased;
}

How can I tell MOXy to ignore the @Transient annotation and to serialise the parameter?


Solution

  • I got with the solution and forgot to put it here...

    basically I had the getter for that field but the setter was missing hence the field was ignored by the json serialiser (moxy in my case).