throws FinderException, RemoteException, BorrowException
{
IBookHome bookHome = getBookHome();
IPersonHome personHome = getPersonHome();
IBook book = bookHome.findByPrimaryKey(bookId);
if (!book.getLendable())
throw new BorrowException("Book may not be borrowed.");
// Verify that the borrower exists.
personHome.findByPrimaryKey(borrowerId);
// TBD: Check that borrower has authenticated
// findByPrimaryKey() throws an exception if the EJB doesn't exist,
// so we're safe.
personHome.findByPrimaryKey(book.getOwnerId());
// Here's the real work; just setting the holder of the book
// to be the borrower.
book.setHolderId(borrowerId);
return getBook(bookId);
}