Book book2 = entityManager.find(Book.class, 2l);
List<Book> borrowList1 = new ArrayList<Book>();
borrowList1.add(book1);
borrowList1.add(book2);
Borrow borrow = new Borrow(entityManager.find(Reader.class, 1l),borrowList1,
new Date(System.currentTimeMillis()), new Date(System.currentTimeMillis() + 3432423423l));
entityManager.close();
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
entityManager.persist(borrow);
entityManager.getTransaction().commit();
borrow.getTitles().get(0).getId();
entityManager.close();
entityManager = entityManagerFactory.createEntityManager();
em.getTransaction().begin();
borrowDAO.deleteBorrow(borrowDAO.findBorrowById(new Long(1)));