Hello all,
I've small question regarding persist an object which contains a list of another object.
In my entity level I have the object Risk which contains a list of actions:
Risk table
Code:
@OneToMany(cascade=CascadeType.ALL, mappedBy="risk")
private Set <Action> actions;
Action table
Code:
@ManyToOne
@JoinColumns({
@JoinColumn(name="P_ID", referencedColumnName="ID", insertable=false, updatable=false),
@JoinColumn(name="V_NO", referencedColumnName="V_NO", insertable=false, updatable=false)
})
private Risk risk;
When I get the risk object, I also get the complete list of associated actions.
But when I save the risk object by doing
Code:
session.save(risk);
, actions are totaly ignored and not persisted in the db.
Of course it works if I do a "session.save()" on all the actions of the risk but I don't like that.
Can someone help me on this?
Thx :-)