Hibernate version: 2.1.8
Mapping documents: classic parent/child bidirectional one to many inverse = true, Area(1) -> (*)Zone
I'm using Spring + hibernateTemplate
So what I do is I want to update a Zone. The zone is disconnected between requests, being stored in a session form bean. When I update the zone, I must specify the area it is in:
Area.addZone() method body:
getZones().add(zone)
zone.setArea(this);
At update form submission I do this:
Area area = getHibernateTemplate().get(Area.class, areaId);
area.addZone(zone);
getHibernateTemplate().update(zone);
Here I get: "a different object with the same identifier value was already associated with the session ... of class: Zone
Can somebody give me a hint how to do to avoid it. Thanks.
|