title: hibernate insert one to many
body: <pre><code>I have a class called A which has set of object of B. On inserting the A all the objects in the set must be inserted. But in my case only the object A is inserting not the sets.
  </code></pre>
  
  <p>Note the class B also have collections of object which may be empty in certain cases.
  Relation : Page 1---->* Classes
  Page.hbm.xml</p>
  
  <pre><code> &lt;hibernate-mapping&gt;
        &lt;class catalog="uml" name="com.project.lwuml.classdiagram.entity.Page" table="page"&gt;
          &lt;id name="id" type="java.lang.Integer"&gt;
            &lt;column name="id"/&gt;
            &lt;generator class="identity"/&gt;
          &lt;/id&gt;
          &lt;property name="content" type="string"&gt;
            &lt;column length="65535" name="content"/&gt;
          &lt;/property&gt;
          &lt;set inverse="true" name="classboxes" table="classbox" lazy="true" fetch="select"&gt;
            &lt;key&gt;
              &lt;column name="page_id" not-null="true"/&gt;
            &lt;/key&gt;
            &lt;one-to-many class="com.project.lwuml.classdiagram.entity.Classbox"/&gt;
          &lt;/set&gt;
        &lt;/class&gt;
      &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>Classboxes.hbm.xml</p>
  
  <pre><code>&lt;hibernate-mapping&gt;
        &lt;class catalog="uml" name="com.project.lwuml.classdiagram.entity.Classbox" table="classbox"&gt;
         &lt;id name="id" type="java.lang.Integer"&gt;
            &lt;column name="id"/&gt;
            &lt;generator class="identity"/&gt;
          &lt;/id&gt;
         &lt;many-to-one class="com.project.lwuml.classdiagram.entity.Accessspecifiers" fetch="select" name="accessspecifiers"&gt;
            &lt;column name="accessspecifiers_id" not-null="true"/&gt;
          &lt;/many-to-one&gt;
         &lt;many-to-one class="com.project.lwuml.classdiagram.entity.Page" fetch="select" name="page"&gt;
            &lt;column name="page_id" not-null="true"/&gt;
          &lt;/many-to-one&gt;
         &lt;property name="className" type="string"&gt;
            &lt;column length="128" name="className"/&gt;
          &lt;/property&gt;
         &lt;set inverse="true" lazy="true" name="classmethods"&gt;
            &lt;key&gt;
              &lt;column name="classbox_id" not-null="true"/&gt;
            &lt;/key&gt;
            &lt;one-to-many class="com.project.lwuml.classdiagram.entity.Classmethod"/&gt;
          &lt;/set&gt;
         &lt;set inverse="true" name="classdatamembers"&gt;
            &lt;key&gt;
              &lt;column name="classbox_id" not-null="true"/&gt;
            &lt;/key&gt;
            &lt;one-to-many class="com.project.lwuml.classdiagram.entity.Classdatamember"/&gt;
          &lt;/set&gt;
        &lt;/class&gt;
     &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>I am using struts-spring-hibernate. Can any body help me out.
  Thanks in advance</p>