[ad_1]
SessionFactory factory = HibernateUtil.getSessionFactory();
Session session = factory.openSession();
session.getTransaction();
gorev.setAciklama(gorev.getAciklama());
gorev.setTarih(gorev.getTarih());
gorev.setDurum(gorev.getDurum());
Query kuid = session.createSQLQuery("insert into gorev (kullaniciid,aciklama,tarih,durum) VALUES ('"+kullanici.getId()+"','" + gorev.getAciklama() + "','" + kullanici.getKadi() +"','" + gorev.getDurum()+ "','");
//List<Kullanici> list = kuid.list();
//session.save(kuid.uniqueResult());
session.save(kuid);
session.beginTransaction();
session.getTransaction().commit();
session.close();
whay i can not add that values on database. i can add use /session.save(gorev)
except id. kullaniciid is my foreign key, refecance table is kullanici and referanced fields is id.
[ad_2]
لینک منبع