979899100101102103104105106107108
return author; } @TransactionAttribute public Book createBook(String title, Author author) { Book book = new Book(); book.setTitle(title); book.setAuthor(author); author.getBooks().add(book); em.persist(book); return book; }
90919293949596979899100101
return author; } @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public Book createBook(String title, Author author) { Book book = new Book(); book.setTitle(title); book.setAuthor(author); author.getBooks().add(book); em.persist(book); return book; }