public BookLending lendBook(Book book, Customer customer) { BookLending bookLending = new BookLending(); bookLending.setBook(book); bookLending.setCustomer(customer); bookLending.setLendingDate(new GregorianCalendar().getTime()); bookLending.setBookIsLended(true); em.persist(bookLending); return bookLending; }