I am using GlassFish 3.1.2.2 with EclipseLink 2.5.0 nightly build 03/06.
TestEntity:
@Entity
public class UserTable implements Serializable {
private static final long serialVersionUID = 8407966960002220704L;
@Id
@GeneratedValue
private long id;
@OneToMany(mappedBy="test", orphanRemoval=true, cascade=CascadeType.ALL, fetch=FetchType.EAGER)
private List<Row> rows;
}
Row:
@Entity
public class Row implements Serializable {
private static final long serialVersionUID = 8285524874443728506L;
@Id
@GeneratedValue
private long id;
@ManyToOne(optional=true)
private TestEntity test;
}
Let's POST the following TestEntity's JSON:
Response 200 OK:
{
"id":10,
"_relationships":[
{
"_link":{
"href":"http://localhost:8080/app/persistence/pu/entity/TestEntity/10/rows",
"rel":"rows"
}
}
],
"rows":[
]
}
GET http://localhost:8080/app/persistence/pu/entity/TestEntity/10/rows 200 OK:
Which is obviously invalid. The output is correct if I add some content to the collection.
[Updated on: Wed, 06 March 2013 15:26]
Report message to a moderator