예제 #1
0
  /** @param args the command line arguments */
  public static void main(String[] args) {
    Session s = NewHibernateUtil.getSessionFactory().openSession();
    Transaction ts = s.beginTransaction();

    Person p =
        new Person(
            "Patrick",
            "",
            "Kann",
            "8-56",
            "21041989",
            "26092013",
            "",
            "",
            "",
            0,
            0,
            0,
            "",
            0,
            null);
    Guest g = new Guest(p, "Lars", "", "Kann", "21041989", "");
    Set guests = new HashSet();
    guests.add(g);
    p.setGuests(guests);
    s.save(p);
    ts.commit();
  }