I have a SLSB with @WebService. I find that pojos have their @Id field set to null when marshalled despite it have a value in the SLSB. In the code fragment below you can see the field has a protected setters. When this signature is changed to public it works as expected.
Problem is that, by design, I cannot make the setter public on an identifying field. Is there a nother way to (un)marshall fields with protected setters?
@Entity public class Foo implements Serializable { private Long fooId; protected Foo() { super(); } @Id public Long getFooId() { return fooId; } protected void setFooId(Long fooId) { this.fooId = fooId; } }
Solved it by explicitly instructing JAXB to serialize the id field. Still, seems like a weird design decision that the defaults don't process protected setters.
@XmlElement private Long fooId;