Closed
Description
Destan Sarpkaya opened DATAREST-931 and commented
User has a repository and Phone has not. [id and some other fields are pruned in below examples for brevity, see full entities in example code]
@Entity
public class User {
private String name;
@Column(nullable = false)
@Temporal(value = TemporalType.TIMESTAMP)
private Calendar creationDate;
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
private List<Phone> phones;
}
@Entity
public class Phone extends BaseEntity {
@Column(nullable = false)
@Temporal(value = TemporalType.TIMESTAMP)
private Calendar creationDate;
@ManyToOne(fetch = FetchType.EAGER)
private User user;
}
In this case patch for /users/1 with following data works:
{
"name":"John Doe X",
"phones":[
{
"id":1,
"creationDate":"2016-11-02T07:34:02.806+0000",
"label":"work",
"number":"00000000"
}
]
}
but following data fails with not-null-constraint error for creationDate:
{
"name":"John Doe X",
"phones":[
{
"id":1,
"label":"work",
"number":"00000000"
}
]
}
PATCH works selectively on resources however doesn't work as expected for inline data which is not a resource (in this case "phone")
Affects: 2.5.4 (Hopper SR4)
Attachments:
- person-repo.zip (6.55 kB)
Backported to: 2.5.5 (Hopper SR5), 2.4.7 (Gosling SR7)