Search in sources :

Example 6 with ReportException

use of org.mifos.reports.exceptions.ReportException in project head by mifos.

the class ReportsPersistence method createReportsParamsMap.

/**
     * Creates a link between a report and a parameter
     */
public void createReportsParamsMap(ReportsParamsMapValue reportsParamsMapValue) throws ApplicationException, SystemException {
    Session session = null;
    try {
        session = StaticHibernateUtil.getSessionTL();
        StaticHibernateUtil.startTransaction();
        session.save(reportsParamsMapValue);
        session.flush();
        StaticHibernateUtil.commitTransaction();
    } catch (HibernateProcessException hpe) {
        StaticHibernateUtil.rollbackTransaction();
        throw new ApplicationException(hpe);
    } catch (HibernateException e) {
        StaticHibernateUtil.rollbackTransaction();
        throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION, e);
    } catch (Exception e) {
        StaticHibernateUtil.rollbackTransaction();
        throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION, e);
    } finally {
        StaticHibernateUtil.closeSession();
    }
}
Also used : HibernateProcessException(org.mifos.framework.exceptions.HibernateProcessException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) HibernateException(org.hibernate.HibernateException) ReportException(org.mifos.reports.exceptions.ReportException) SystemException(org.mifos.framework.exceptions.SystemException) ReportException(org.mifos.reports.exceptions.ReportException) HibernateProcessException(org.mifos.framework.exceptions.HibernateProcessException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) HibernateException(org.hibernate.HibernateException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) Session(org.hibernate.Session)

Example 7 with ReportException

use of org.mifos.reports.exceptions.ReportException in project head by mifos.

the class ReportsPersistence method createReportParams.

public void createReportParams(ReportsParamsValue reportsParams) throws ApplicationException, SystemException {
    Session session = null;
    Transaction trxn = null;
    try {
        session = StaticHibernateUtil.getSessionTL();
        StaticHibernateUtil.startTransaction();
        session.save(reportsParams);
        session.flush();
        StaticHibernateUtil.commitTransaction();
    } catch (HibernateProcessException hpe) {
        StaticHibernateUtil.rollbackTransaction();
        throw new ApplicationException(hpe);
    } catch (HibernateException hpe) {
        trxn.rollback();
        throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION);
    } catch (Exception e) {
        trxn.rollback();
        throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION, e);
    } finally {
        StaticHibernateUtil.closeSession();
    }
}
Also used : HibernateProcessException(org.mifos.framework.exceptions.HibernateProcessException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) Transaction(org.hibernate.Transaction) HibernateException(org.hibernate.HibernateException) ReportException(org.mifos.reports.exceptions.ReportException) SystemException(org.mifos.framework.exceptions.SystemException) ReportException(org.mifos.reports.exceptions.ReportException) HibernateProcessException(org.mifos.framework.exceptions.HibernateProcessException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) HibernateException(org.hibernate.HibernateException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) Session(org.hibernate.Session)

Aggregations

HibernateException (org.hibernate.HibernateException)7 Session (org.hibernate.Session)7 ApplicationException (org.mifos.framework.exceptions.ApplicationException)7 HibernateProcessException (org.mifos.framework.exceptions.HibernateProcessException)7 PersistenceException (org.mifos.framework.exceptions.PersistenceException)7 SystemException (org.mifos.framework.exceptions.SystemException)7 ReportException (org.mifos.reports.exceptions.ReportException)7 Transaction (org.hibernate.Transaction)1