@@ -0,0 +1,1033 @@
+package com.github.aureliano.edocs.service.helper;%0A%0Aimport java.sql.SQLException;%0A%0Aimport com.github.aureliano.edocs.common.exception.EDocsException;%0Aimport com.github.aureliano.edocs.common.exception.ServiceException;%0Aimport com.github.aureliano.edocs.common.persistence.IPersistenceManager;%0Aimport com.github.aureliano.edocs.common.persistence.PersistenceService;%0A%0Apublic final class ServiceHelper %7B%0A%0A%09private ServiceHelper() %7B%7D%0A%09%0A%09public static %3CT%3E T executeActionInsideTransaction(T bean, boolean saveAction) %7B%0A%09%09IPersistenceManager pm = PersistenceService.instance().getPersistenceManager();%0A%09%09T entity = null;%0A%09%09%0A%09%09try %7B%0A%09%09%09pm.getConnection().setAutoCommit(false);%0A%09%09%09if (saveAction) %7B%0A%09%09%09%09entity = pm.save(bean);%0A%09%09%09%7D else %7B%0A%09%09%09%09pm.delete(bean);%0A%09%09%09%7D%0A%09%09%09pm.getConnection().commit();%0A%09%09%7D catch (EDocsException ex) %7B%0A%09%09%09try %7B%0A%09%09%09%09pm.getConnection().rollback();%0A%09%09%09%7D catch (SQLException ex2) %7B%0A%09%09%09%09throw new ServiceException(ex2);%0A%09%09%09%7D%0A%09%09%7D catch (SQLException ex) %7B%0A%09%09%09throw new ServiceException(ex);%0A%09%09%7D%0A%09%09%0A%09%09return entity;%0A%09%7D%0A%7D

Create service helper.