Hi,
I have difficulties in adding transient objects into a Set... can someone shed some light on what I'm missing. :)
To begin with, my transient objects have the same
null identifier (please correct me if I'm wrong in doing so). Consequently these transient objects are deemed to be equal by a Set. Hence there's no way for me to add more than 1 transient objects to the same Set as only the first addition will be effective.
The last code example in section 8.2 of the Hibernate docs is a good illustration. How do I add 2 Children to the Parent at one go? My code fragment below manages to add only 1 Children:
Code:
Parent p = (Parent)session.load(Parent.class, pid);
Child c1 = new Child("Tommy");
Child c2 = new Child("Jimmy");
p.addChild(c1);
p.addChild(c2);
session.save(c);
session.flush();
Thanks in advance! :)
--
chyun