Hibernate Ders05 - Inheritance Mapping - II
Inheritance mapping - I 'de yaptığımız örneği şimdi notasyon kullanarak yapacağız. Main.java package test; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; public class Main { public static void main(String[] args) { Configuration cfg= new Configuration(); cfg. configure ( "hibernate.cfg.xml" ); SessionFactory factory=cfg. buildSessionFactory (); Session session=factory. openSession (); Transaction t=session. beginTransaction (); Personel p = new Personel(); p. setAd ( "enes" ); Maas m = new Maas(); m. setAd ( "enes2" ); m. setMaas ( 3500 ); Araba a = new Araba(); a. setAd ( "enes3" ); a. setMarka ( "opel" ); a. setModel ( "astra" ); session. persist (p); session. persist (m); session. persist (a); t. commit (); session. close (); System. out...