private void reloadMembers() {
   if (fund != null) {
     fund = (FundBO) StaticHibernateUtil.getSessionTL().get(FundBO.class, fund.getFundId());
   }
   if (fundBO != null) {
     fundBO = (FundBO) StaticHibernateUtil.getSessionTL().get(FundBO.class, fundBO.getFundId());
   }
 }
  public void save(List<AccountBO> customerAccounts) {

    Session session = StaticHibernateUtil.getSessionTL();
    for (AccountBO account : customerAccounts) {
      session.save(account);
    }
  }
  /** @see #addGeneralLedgerAccount(String, String, String, GLCategoryType) */
  private COABO addGeneralLedgerAccount(
      String name, String glcode, Short parent_id, GLCategoryType categoryType) {
    Short id = getAccountIdFromGlCode(glcode);
    if (id != null) {
      throw new RuntimeException(
          "An account already exists with glcode: " + glcode + ". id was " + id);
    }

    GLCodeEntity glCodeEntity = new GLCodeEntity(null, glcode);
    try {
      createOrUpdate(glCodeEntity);
      COABO newAccount = new COABO(name, glCodeEntity);
      newAccount.setCategoryType(categoryType);
      createOrUpdate(newAccount);

      COABO parentCOA;
      COAHierarchyEntity coaHierarchyEntity = null;
      if (null == parent_id) {
        coaHierarchyEntity = new COAHierarchyEntity(newAccount, null);
      } else {
        parentCOA = (COABO) StaticHibernateUtil.getSessionTL().load(COABO.class, parent_id);
        coaHierarchyEntity = new COAHierarchyEntity(newAccount, parentCOA.getCoaHierarchy());
      }

      createOrUpdate(coaHierarchyEntity);
      newAccount.setCoaHierarchy(coaHierarchyEntity);

      return newAccount;
    } catch (PersistenceException e) {
      throw new RuntimeException(e);
    }
  }
 public List<ActivityEntity> getActivities() throws PersistenceException {
   try {
     return getActivities(StaticHibernateUtil.getSessionTL());
   } catch (Exception e) {
     throw new PersistenceException(e);
   }
 }
 @SuppressWarnings("unchecked")
 private <T extends MasterDataEntity> List<T> doFetchListOfMasterDataFor(Class<T> type) {
   Session session = StaticHibernateUtil.getSessionTL();
   List<T> masterEntities = session.createQuery("from " + type.getName()).list();
   for (MasterDataEntity masterData : masterEntities) {
     Hibernate.initialize(masterData.getNames());
     Hibernate.initialize(masterData.getLookUpValue());
     Hibernate.initialize(masterData.getLookUpValue().getLookUpValueLocales());
   }
   return masterEntities;
 }
 /*
  * Execute a named query during initialization that does not include logging or other dependencies. This is a
  * workaround for issues related to interdependencies between initialization routines in {@link
  * ApplicationInitializer}
  */
 private List executeNamedQueryAtInit(String queryName, Map queryParameters)
     throws PersistenceException {
   Session session = null;
   try {
     session = StaticHibernateUtil.getSessionTL();
     Query query = session.getNamedQuery(queryName);
     query.setProperties(queryParameters);
     return query.list();
   } catch (Exception e) {
     throw new PersistenceException(e);
   }
 }
 public QueryResult getAllAccountNotes(Integer accountId) throws PersistenceException {
   QueryResult notesResult = null;
   try {
     Session session = null;
     notesResult = QueryFactory.getQueryResult("NotesSearch");
     session = StaticHibernateUtil.getSessionTL();
     Query query = session.getNamedQuery(NamedQueryConstants.GETALLACCOUNTNOTES);
     query.setInteger("accountId", accountId);
     notesResult.executeQuery(query);
   } catch (Exception e) {
     throw new PersistenceException(e);
   }
   return notesResult;
 }
Exemple #8
0
 public void save(AuditLog auditLog) {
   try {
     // explicit close session calls required to avoid infinite looping of audit logs
     // afterTransaction
     StaticHibernateUtil.closeSession();
     Session session = StaticHibernateUtil.getSessionTL();
     StaticHibernateUtil.startTransaction();
     session.save(auditLog);
     StaticHibernateUtil.commitTransaction();
     StaticHibernateUtil.closeSession();
   } catch (Exception e) {
     StaticHibernateUtil.rollbackTransaction();
     StaticHibernateUtil.closeSession();
     throw new RuntimeException(e);
   }
 }
  @SuppressWarnings("unchecked")
  @Override
  public List<LookUpEntity> findLookupValueTypes() {

    Session session = StaticHibernateUtil.getSessionTL();

    List<LookUpEntity> entities = session.getNamedQuery(NamedQueryConstants.GET_ENTITIES).list();

    for (LookUpEntity entity : entities) {
      Set<LookUpLabelEntity> labels = entity.getLookUpLabels();
      entity.getEntityType();
      for (LookUpLabelEntity label : labels) {
        label.getLabelText();
        label.getLocaleId();
      }
    }

    return entities;
  }
  public void testUpdate() throws Exception {
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);

    for (int listIndex = 0; listIndex < configurationNameSet.length; ++listIndex) {
      String originalValue = "";
      StaticHibernateUtil.getSessionTL();

      for (int operationIndex = 0; operationIndex < operations.length; ++operationIndex) {
        createFlowAndAddToRequest(LookupOptionsAction.class);

        setRequestPathInfo("/lookupOptionsAction.do");
        addRequestParameter("method", "update");

        LookupOptionData data = new LookupOptionData();
        originalValue =
            prepareForUpdate(
                configurationNameSet[listIndex][MASTER_CONSTANT],
                configurationNameSet[listIndex][CONFIG_CONSTANT],
                configurationNameSet[listIndex][LIST_NAME],
                operations[operationIndex],
                data,
                names[operationIndex]);

        SessionUtils.setAttribute(ConfigurationConstants.LOOKUP_OPTION_DATA, data, request);
        addRequestParameter(
            ConfigurationConstants.ENTITY, configurationNameSet[listIndex][CONFIG_CONSTANT]);

        actionPerform();
        verifyNoActionErrors();
        verifyNoActionMessages();
        verifyForward(ActionForwards.update_success.toString());
      }
      StaticHibernateUtil.flushAndClearSession();

      StaticHibernateUtil.startTransaction();

      verifyOneListAndRestoreOriginalValues(
          configurationNameSet[listIndex][MASTER_CONSTANT],
          configurationNameSet[listIndex][CONFIG_CONSTANT],
          configurationNameSet[listIndex][LIST_NAME],
          originalValue);
    }
  }
 public void updatePayment(AccountPaymentEntity payment) {
   StaticHibernateUtil.getSessionTL().update(payment);
 }
 public void save(AccountOverpaymentEntity overpaymentEntity) {
   StaticHibernateUtil.getSessionTL().save(overpaymentEntity);
 }
 private FundBO createFund(String fundName) throws Exception {
   FundCodeEntity fundCodeEntity =
       (FundCodeEntity) StaticHibernateUtil.getSessionTL().get(FundCodeEntity.class, (short) 1);
   return TestObjectFactory.createFund(fundCodeEntity, fundName);
 }
 @Override
 public void setUp() {
   session = StaticHibernateUtil.getSessionTL();
 }
 public AcceptedPaymentType getAcceptedPaymentType(Short paymentTypeId) {
   Session session = StaticHibernateUtil.getSessionTL();
   return (AcceptedPaymentType) session.get(AcceptedPaymentType.class, paymentTypeId);
 }
 // Exposed for testing
 void clearSessionAndRollback() {
   StaticHibernateUtil.getSessionTL().clear();
   transactionHelper.rollbackTransaction();
 }