i use the playframework and tried to deserialize some json into a java object. It worked fine, exept the relationship in the model. I got the following exception
when limited time +ee: +jax-rs && +persistence, +gson; I have solved it then as:
@Entity
@XmlRootElement
@Table(name="element")
public class Element implements Serializable {
public Element(String stringJSON){
Gson g = new Gson();
Element a = g.fromJson(stringJSON, this.getClass());
this.setId(a.getId());
this.setProperty(a.getProperty());
}
public Element() {}
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
...
}