Search in sources :

Example 11 with HibernateException

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

the class ReportsPersistence method createReportsDataSource.

public void createReportsDataSource(ReportsDataSource reportsDataSource) throws ApplicationException, SystemException {
    Session session = null;
    try {
        session = StaticHibernateUtil.getSessionTL();
        StaticHibernateUtil.startTransaction();
        session.save(reportsDataSource);
        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 12 with HibernateException

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

the class EntityMasterData method init.

/**
     * This method creates a map of entity master table as sets it into the
     * servletcontext so that it is available till the application is up.
     *
     * @throws HibernateProcessException
     */
public void init() throws HibernateProcessException {
    Session session = null;
    try {
        session = StaticHibernateUtil.getSessionTL();
        Query query = session.getNamedQuery(NamedQueryConstants.GET_ENTITY_MASTER);
        List<EntityMaster> entityMasterData = query.list();
        for (EntityMaster entityMaster : entityMasterData) {
            entityMap.put(entityMaster.getEntityType(), entityMaster.getId());
        }
    } catch (HibernateException e) {
        logger.error("table entity_master could not be fetched", e);
    }
}
Also used : Query(org.hibernate.Query) HibernateException(org.hibernate.HibernateException) EntityMaster(org.mifos.framework.business.EntityMaster) Session(org.hibernate.Session)

Example 13 with HibernateException

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

the class ReportsPersistence method deleteReportsParamsMap.

/**
     * Deletes a link between report and a parameter
     */
public void deleteReportsParamsMap(ReportsParamsMapValue reportsParamsMapValue) throws ApplicationException, SystemException {
    Session session = null;
    try {
        session = StaticHibernateUtil.getSessionTL();
        StaticHibernateUtil.startTransaction();
        session.delete(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 14 with HibernateException

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

the class ReportsPersistence method deleteReportParams.

public void deleteReportParams(ReportsParamsValue reportsParams) throws ApplicationException, SystemException {
    Session session = null;
    try {
        session = StaticHibernateUtil.getSessionTL();
        StaticHibernateUtil.startTransaction();
        session.delete(reportsParams);
        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 15 with HibernateException

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

the class ReportsPersistence method updateReportsJasperMap.

/**
     * sets a link between report and a jasper file
     */
public void updateReportsJasperMap(ReportsJasperMap reportsJasperMap) throws ApplicationException, SystemException {
    Session session = null;
    try {
        session = StaticHibernateUtil.getSessionTL();
        StaticHibernateUtil.startTransaction();
        session.update(reportsJasperMap);
        session.flush();
        StaticHibernateUtil.commitTransaction();
    } catch (HibernateProcessException e) {
        StaticHibernateUtil.rollbackTransaction();
        throw new ApplicationException(e);
    } 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)

Aggregations

HibernateException (org.hibernate.HibernateException)609 Session (org.hibernate.Session)285 DAOException (com.tomasio.projects.trainning.exception.DAOException)186 DAOException (org.jbei.ice.storage.DAOException)122 ArrayList (java.util.ArrayList)63 Criteria (org.hibernate.Criteria)56 Test (org.junit.Test)43 Transaction (org.hibernate.Transaction)39 SQLException (java.sql.SQLException)38 SimpleDateFormat (java.text.SimpleDateFormat)22 Query (org.hibernate.Query)20 IOException (java.io.IOException)19 ParseException (java.text.ParseException)18 TestForIssue (org.hibernate.testing.TestForIssue)16 Date (java.util.Date)13 List (java.util.List)12 PersistenceException (org.mifos.framework.exceptions.PersistenceException)12 Serializable (java.io.Serializable)11 HashMap (java.util.HashMap)11 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)11