This is how I store my data.
My utstyr table has a foreign key to kategori.
Code:
session = HibernateUtil.getSessionFactory().getCurrentSession();
BaatManager baatMgr = BaatkatalogenFactory.getBaatkatalogen().getBaatManager();
KategoriData kategori = new KategoriData();
kategori = baatMgr.getKategoriByKnavn("kategori");
//This code above retrieves a Kategori object based on the parameter
UtstyrData utstyr = new UtstyrData();
utstyr.setId("" + System.currentTimeInMillis());
utstyr.setUnavn("utstyr");
utstyr.setKategori(kategori);
//Here is insert the kategori in utstyr
session.beginTransaction();
session.save(utstyr);
//Save when all set methods are finished
session.getTransaction().commit();
You will have to do similiar. You will need to get the user object based on id or name or something, and then set that in your other object and then save.
Hope this helped.