1 Reply Latest reply on Dec 10, 2012 9:39 AM by esteve

    XmlTransient annotation ignored?

    tito.coluccelli

      Hi,

      I got the exception:

      org.codehaus.jackson.map.JsonMappingException: failed to lazily initialize a collection of role: ...  no session or session was closed ...

      on an entity bean (ejb 3.1) that declared something like this:

       

      @OneToMany(fetch=FetchType.LAZY,mappedBy = "post")

      @XmlTransient

      List<Comment> commentList;

       

      The exception disappeared when I introduced the annotation:

      org.codehaus.jackson.annotate.JsonIgnore (from the package org.jboss.resteasy:resteasy-jackson-provider)

      on the same field.

       

      Isn't it enough to put XmlTransient annotation over the field?

      Thanks.