InvoiceIdService idService = ServiceFactory.getInvoiceIdService();
InvoiceId invId = idService.newWOJIdent(o);
idService.validateIdent(invId);
Invoice i = (Invoice)DaoFactory.getInvoiceDao().newHandledObject();
o.setInvoice(i);
i.setPdf(InvoiceBuilderFactory.getBuilder().buildInvoicePDF(o, p, invId.getIdent()));
i.setIdent(invId.getIdent());
DaoFactory.getInvoiceDao().save(i);
DaoFactory.getOrderDao().save(o);
LOGGER.info(MessageFormat.format("new invoice[{0}] created for user[{1}]", new Object[] {new Long(i.getId()), o.getBuyer().getLogin()}));
return i;
} catch (DataAccessException dae) {
LOGGER.debug("error creating invoice", dae);
throw new ServiceException("cannot create invoice", dae);
} catch (DaoException e) {