ELIN NUGROHO 085610038 ORM MODUL 4 Untuk database OneToMany.java package omodul4; import java.util.HashMap; import java.util.HashSet; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class OneToMany { public static void main(String[] args){ EntityManagerFactory emf=null; EntityManager em=null; try{ ELIN NUGROHO 085610038 ORM MODUL 4 emf=Persistence.createEntityManagerFactory("onetomany", new HashMap()); em=emf.createEntityManager(); em.getTransaction().begin(); Students student = new Students(); student.setName("Zaki Ahmad Adtiya"); student.setAddress("Griya Purwa Asih H-304"); Marks mark = new Marks(); mark.setSubject("ORM Programming"); mark.setMarks("A"); Marks mark1 = new Marks(); mark1.setSubject("Object-Oriented Programming"); mark1.setMarks("B"); Marks mark2 = new Marks(); mark2.setSubject("Enterprise Information System"); mark2.setMarks("C"); HashSet childSet = new HashSet(); childSet.add(mark); childSet.add(mark1); childSet.add(mark2); }catch(Exception e){ System.out.println(e.getMessage()); }finally{ emf.close(); em.close(); } } }