Search in sources :

Example 16 with Query

use of org.hibernate.Query in project head by mifos.

the class CustomerPersistence method getAllCustomerNotes.

public QueryResult getAllCustomerNotes(final Integer customerId) throws PersistenceException {
    QueryResult notesResult = null;
    try {
        Session session = null;
        notesResult = QueryFactory.getQueryResult("NotesSearch");
        session = StaticHibernateUtil.getSessionTL();
        Query query = session.getNamedQuery(NamedQueryConstants.GETALLCUSTOMERNOTES);
        query.setInteger("CUSTOMER_ID", customerId);
        notesResult.executeQuery(query);
    } catch (HibernateProcessException hpe) {
        throw new PersistenceException(hpe);
    } catch (HibernateSearchException hse) {
        throw new PersistenceException(hse);
    }
    return notesResult;
}
Also used : QueryResult(org.mifos.framework.hibernate.helper.QueryResult) HibernateProcessException(org.mifos.framework.exceptions.HibernateProcessException) Query(org.hibernate.Query) HibernateSearchException(org.mifos.framework.exceptions.HibernateSearchException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Session(org.hibernate.Session)

Example 17 with Query

use of org.hibernate.Query in project head by mifos.

the class LoanRepaymentTag method getMemberScheduleDetails.

@SuppressWarnings("unchecked")
private List<LoanBO> getMemberScheduleDetails(Integer parentId) {
    Session hibSession = StaticHibernateUtil.getSessionTL();
    Query query = hibSession.getNamedQuery("LoanBO.getMemberDetails");
    query.setParameter("ACCOUNT_ID", parentId);
    return (List<LoanBO>) query.list();
}
Also used : Query(org.hibernate.Query) ArrayList(java.util.ArrayList) List(java.util.List) Session(org.hibernate.Session) HttpSession(javax.servlet.http.HttpSession)

Example 18 with Query

use of org.hibernate.Query in project head by mifos.

the class LoanArrearsAgingHelper method generateLoanArrearsAging.

private void generateLoanArrearsAging() throws BatchJobException {
    StaticHibernateUtil.startTransaction();
    try {
        Query insert_select = StaticHibernateUtil.getSessionTL().getNamedQuery("generateLoanArrearsAging");
        insert_select.setParameter("CURRENT_DATE", new LocalDate().toString());
        insert_select.executeUpdate();
        StaticHibernateUtil.commitTransaction();
    } catch (Exception e) {
        StaticHibernateUtil.rollbackTransaction();
        throw new BatchJobException(e);
    }
}
Also used : BatchJobException(org.mifos.framework.components.batchjobs.exceptions.BatchJobException) Query(org.hibernate.Query) LocalDate(org.joda.time.LocalDate) BatchJobException(org.mifos.framework.components.batchjobs.exceptions.BatchJobException)

Example 19 with Query

use of org.hibernate.Query in project head by mifos.

the class LoanArrearsAgingHelper method deleteAllLoanArrearsAging.

private void deleteAllLoanArrearsAging() throws BatchJobException {
    StaticHibernateUtil.startTransaction();
    try {
        Query delete = StaticHibernateUtil.getSessionTL().getNamedQuery("deleteAllLoanArrearsAging");
        delete.executeUpdate();
        StaticHibernateUtil.commitTransaction();
    } catch (Exception e) {
        StaticHibernateUtil.rollbackTransaction();
        throw new BatchJobException(e);
    }
}
Also used : BatchJobException(org.mifos.framework.components.batchjobs.exceptions.BatchJobException) Query(org.hibernate.Query) BatchJobException(org.mifos.framework.components.batchjobs.exceptions.BatchJobException)

Example 20 with Query

use of org.hibernate.Query in project head by mifos.

the class FinancialInitializer method initalizeFinancialAction.

@SuppressWarnings("unchecked")
public static void initalizeFinancialAction() throws FinancialException {
    Session session = StaticHibernateUtil.getSessionTL();
    try {
        Query queryFinancialAction = session.getNamedQuery(FinancialQueryConstants.GET_ALL_FINANCIAL_ACTION);
        List<FinancialActionTypeEntity> listFinancialAction = queryFinancialAction.list();
        for (FinancialActionTypeEntity fabo : listFinancialAction) {
            FinancialActionCache.addToCache(fabo);
        }
    } catch (Exception e) {
        throw new FinancialException(FinancialExceptionConstants.FINANCIALACTION_INITFAILED, e);
    }
}
Also used : FinancialActionTypeEntity(org.mifos.accounts.financial.business.FinancialActionTypeEntity) Query(org.hibernate.Query) FinancialException(org.mifos.accounts.financial.exceptions.FinancialException) FinancialException(org.mifos.accounts.financial.exceptions.FinancialException) IOException(java.io.IOException) ConfigurationException(org.mifos.config.exceptions.ConfigurationException) Session(org.hibernate.Session)

Aggregations

Query (org.hibernate.Query)481 Session (org.hibernate.Session)223 Test (org.junit.Test)184 List (java.util.List)85 Transaction (org.hibernate.Transaction)80 ArrayList (java.util.ArrayList)52 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)31 TestForIssue (org.hibernate.testing.TestForIssue)28 SQLQuery (org.hibernate.SQLQuery)27 MifosRuntimeException (org.mifos.core.MifosRuntimeException)24 PersistenceException (org.mifos.framework.exceptions.PersistenceException)22 HibernateException (org.hibernate.HibernateException)19 Collection (java.util.Collection)14 Date (java.util.Date)14 HashMap (java.util.HashMap)12 Iterator (java.util.Iterator)12 BigDecimal (java.math.BigDecimal)11 Map (java.util.Map)11 HibernateSearchException (org.mifos.framework.exceptions.HibernateSearchException)11 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)10