title: unable to update objects of one to one relation in hibernate
body: <p>I have relation as shown bellow:</p>
  
  <pre><code>    @Entity
  @Table(name = "ORDER_", catalog = "smartorder")
  public class Order implements Serializable {
  
      /**
       * serial version id
       */
      private static final long serialVersionUID = 13875615L;
  
      @Id
      @Column(name = "ORDER_ID", unique = true, nullable = false)
      @SequenceGenerator(name = "ORDER_ID_GEN", sequenceName = "ORDER_ID_SEQ")
      @GeneratedValue(generator = "ORDER_ID_GEN")
      private long orderId;
  
      @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
      @JoinColumn(name = "INVOICE_ID", referencedColumnName = "INVOICE_ID")
      private Invoice invoice;
  
      // setters and getters
  }
  
  
  
  
  
  @Entity
  @Table(name = "INVOICE_")
  public class Invoice implements Serializable {
      /**
       * serial version id
       */
      private static final long serialVersionUID = 13875612L;
  
      @Id
      @Column(name = "INVOICE_ID", unique = true, nullable = false)
      @SequenceGenerator(name = "INVOICE_ID_GEN", sequenceName = "INVOICE_ID_SEQ")
      @GeneratedValue(generator = "INVOICE_ID_GEN")
      private int invoiceId;
  
      @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
      @JoinColumn(name = "ORDER_ID", referencedColumnName = "ORDER_ID")
      private Order order;
  
      @Column(name = "SUB_TOTAL", precision = 6, nullable = false)
      private double subTotal;
  
      @Column(name = "SERVICE_TAX", precision = 6, nullable = false)
      private double serviceTax;
  
      @Column(name = "VAT", precision = 6, nullable = false)
      private double vat;
  
      @Column(name = "SURCHAARGE", precision = 6, nullable = false)
      private double surChaarge;
  
      @Column(name = "GRAND_TOTAL", precision = 6, nullable = false)
      private double grandTotal;
  
  
      //setters and getters
  }
  </code></pre>
  
  <p>I am able to save the records properly. But when i am trying to update orders objects by setting invoice object to order object then the order object is nor persisting only invoice object is persisting.</p>
  
  <pre><code>Order o = getSession().load(Order.class,1L);
  o.setInvoice(new Invoice(.........));
  getSession().update(o);
  </code></pre>
  
  <p>in console I am able to see one SQL statement only,
  insert into INVOICE_ (DISCOUNT, GRAND_TOTAL, ORDER_ID, ROUNDING, SERVICE_TAX, SUB_TOTAL, SURCHAARGE, VAT) values (?, ?, ?, ?, ?, ?, ?, ?)</p>
  
  <p>Invoice Id is not getting update in Order table :(</p>
  
  <p>Can anyone suggest whats the issue is.</p>
  
  <p>Thanks in advance.....</p>