I work with hibernate 3.2.0 and i faced the following problem
Probleme environment
--3 persisted classes(p1, p2 and p3) with the following relations
--p1 one-to-many p2 one-to-many p3 [p1 many-many p3] with lazy loading
, save-update cascade style and bidirectional navigation using maps in the one-side with the many-side id as the map key
Problem case
--loading a persisted instanse of p1, so we have a persisted map of p2(proxy) then trying to put a new entry of p3 in it's many side of p2 and finally updatting the p2 instanse hoping hibernate to cascade the process and saves the new p3 instanse.
--After debugging i found that hibernate at the line of insertion of new p3 instanse only initializes the p2 instanse and cancells the insertion as follow
P1 p1 = (P1) session.get(P1.class, p1Id);
P3 p3 = new P3();
p1.getP2(p2Id).getP3.put(p3.getId(), p3); //Map<pId, p>
session.update(p2);
--Hibernates ignores the puttting of p3 in p2
--In Hibernate 3.2.3 this problem solved, so i want a solution without changing my hibernate version.if any exists
thank you
|