I have a question and it could be a very simple/silly question for you. Please reply back to my post immediately as soon as possible. Please treat this as very urgent. Thanks a lot for the help in advance.
When I save a parent, the children do not get saved, unless i save them independently. Is there anyway that i can bypass saving children independently? I just wanted to make one call to save parent which should take care of saving children as well. please guide me. This is a unidirectional one-to-many mapping.
<class name="Parent" lazy="true" proxy="Parent" table="parent">
<id name="id" access="field" type="long" >
<!-- some properties here -->
<set name="children" cascade="all,delete-orphan"
<key column="parentid" not-null="true"/>
here is the code :
Session session1 = sf.openSession();
Parent parent1 = (Parent )session1.load(Parent.class, 123);
parent parent2 = new Parent(parent1);
Session session2 = sf.openSession();
Please let me know what is wrong here. Thanks a lot.