Hi there,
I have two classes:
public class Edge implements Serializable {
@Id
@GenericGenerator(name = "gen", strategy = "uuid")
@GeneratedValue(generator = "gen")
private String id;
@OneToMany(mappedBy="edge", fetch=FetchType.EAGER)
@IndexColumn(name="id")
private List<Lane> lanes = new ArrayList<Lane>();
public List<Lane> getLanes() {
return lanes;
}
public void setLanes(ArrayList<Lane> lanes) {
this.lanes = lanes;
}
}
---------------------------
@Entity
@Table(name="lanes")
public class Lane implements Serializable {
@Id
@GenericGenerator(name = "aName", strategy = "uuid")
@GeneratedValue(generator = "aName")
private String Id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name="edge")
private Edge edge;
public Edge getEdge() {
return edge;
}
public void setEdge(Edge edge) {
this.edge = edge;
}
}
---------------------------------
In my understanding of eager fetch, all corresponding Lanes should be loaded, when I load an edge. Unfortunately, this is not done. The same problem occurs while saving. When I persist an edge, its lanes are not persisted. Does anyone know, what could be the problem?
|