OneToMany bidirectional

DulcetAirman Feb 23rd, 2017 (edited) 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. em.getTransaction().begin();
  2. Owner owner = new Customer();
  3. Foo f1 = new Order();
  4. Foo f2 = new Order();
  5. List<Foo> foos = new LinkedList<>();
  6. foos.add(f1); foos.add(f2);
  7. owner.setOrders(foos);
  8. em.persist(owner);
  9. em.getTransaction().commit();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand