I'm playing with the Spring Data examples. I've defined an entity Parent that has a set of Child entities associated.
@Entity
@Table
@Data
public class Parent {
@Id
@GeneratedValue
private Integer id;
@NotNull
private String name;
@Fetch(FetchMode.SUBSELECT)
@OneToMany(fetch = EAGER, cascade = {ALL}, orphanRemoval = true)
private Set<Child> childs;
}
@Entity
@Table
@Data
public class Item {
@Id
@GeneratedValue
private Integer id;
@NotNull
private String name;
}
And the corresponding repositories. My problem is that when posting with curl a new Parent
with a Child
, I run into the error Could not read JSON document: Failed to convert from type [java.net.URI] to type
also described here. The answer to that question states that child entities need to be posted before, and then use the returned URL. That's the same process described in this answer by Oliver Gierke.
Is there any way of configuring Spring Data to deserialize full child entities?