if(personAccount == null){ personAccount = new PersonAccount(guide.getPerson()); sp.getIPersistentPersonAccount().simpleLockWrite(personAccount); }
    public void run(Integer guideEntryID, IUserView userView) throws ExcepcaoPersistencia,            ExistingServiceException {        ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();        IGuideEntry guideEntry = (IGuideEntry) sp.getIPersistentGuideEntry().readByOID(GuideEntry.class,                guideEntryID);        IGuide guide = guideEntry.getGuide();        IPersistentInsuranceTransaction insuranceTransactionDAO = sp                .getIPersistentInsuranceTransaction();        IStudent student = sp.getIPersistentStudent().readByPersonAndDegreeType(guide.getPerson(),                DegreeType.MASTER_DEGREE);        IPerson responsible = sp.getIPessoaPersistente().lerPessoaPorUsername(userView.getUtilizador());        List insuranceTransactionList = insuranceTransactionDAO                .readAllNonReimbursedByExecutionYearAndStudent(guide.getExecutionDegree()                        .getExecutionYear(), student);        if (insuranceTransactionList.isEmpty() == false) {            throw new ExistingServiceException(                    "error.message.transaction.insuranceTransactionAlreadyExists");        }        IPersonAccount personAccount = sp.getIPersistentPersonAccount().readByPerson(guide.getPerson().getIdInternal());        IInsuranceTransaction insuranceTransaction = new InsuranceTransaction(guideEntry.getPrice(),                new Timestamp(Calendar.getInstance().getTimeInMillis()), guideEntry.getDescription(),                guide.getPaymentType(), TransactionType.INSURANCE_PAYMENT, Boolean.FALSE, responsible,                personAccount, guideEntry, guide.getExecutionDegree().getExecutionYear(), student);        sp.getIPersistentInsuranceTransaction().lockWrite(insuranceTransaction);    }