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();
}
}
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);
}
}
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();
}
}
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();
}
}
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();
}
}
Aggregations