title: Why does updating children of a record, remove the connection with its children?
body: <p>I need to update the items of the following class, although I can update all the items but all fields of the class will be changed to null, and its connection to its members will be removed.</p>
  
  <pre><code>@Entity
  public class Category implements Serializable {
      @Id
      @GeneratedValue
      private long id;
  
      @OneToMany( cascade = CascadeType.ALL, orphanRemoval = true)
      @LazyCollection(LazyCollectionOption.FALSE)
      private List&lt;Items&gt; items;
  
      private float price;
  
       @ManyToOne
      private Staff user;
  
       @ManyToOne
      private Staff owner;
  
      @Temporal(javax.persistence.TemporalType.DATE)
      private Date createDate;
      ....
  
  @Entity
  public class Items {
  
      @Id 
      @GeneratedValue
      private Long id;
  
      private int serial;
  
      @OneToOne
      private Product product;
      .....
  </code></pre>
  
  <p><strong>Hibernate</strong></p>
  
  <pre><code>            Category cat = (Category) session.get(Category.class, id);
              for (int i = 0; i &lt; cat.getItems().size(); i++) {
                      cat.getItems().get(i).getProduct().setQuantity(10);
  
                      Part part = new Part();
                      part.setName("Temp");
                      cat.getItems().get(i).getProduct().getPart.add(part);
  
                      session.update(cat.getItems().get(i).getProduct());
                      session.save(part);
  
              }
              tx.commit();
  </code></pre>
  
  <p><strong>Example</strong>   </p>
  
  <p>Before Update </p>
  
  <pre><code>Category 
  1 2000 Alex Jack 05-05-2014
  
  category_categoryitem
  
  1 137
  
  categoryitem
  
  137 900 20
  </code></pre>
  
  <p>After Update </p>
  
  <pre><code>category
  1 0 Null Null Null
  
  category_categoryitem
  
  
  categoryitem 
  
  137 900 20
  </code></pre>