When I have a SQL failure (value to large for column) during a save (or saveOrUpdate), the lifecycle objects are discarded from the Set on the containing object.
Briefly, something like this:
public class Wart extends Synchonzied {
public Wart(Frog frog) {
this.host = frog;
}
Long id = null;
String color = null;
Frog host = null;
...
}
public class Frog extends Syncrhonized {
public Long id = null;
public Set warts = null; // collection of Warts
...
}
...
Frog larry = new Frog();
larry.addWart(new Wart(larry));
...
session.beginTransaction();
session.save(larry);
...
...println(larry.getWarts().size());
Output: 0
|