@Transactional public OffersInfo updateOffersInfo(int companyId, int offerId, OffersInfo offersInfo) throws Exception { try { OfferInfoPrimaryKey id = Conversions.getOfferInfoPrimaryKey(companyId, offerId); OfferInfoDbType dbEntry = offersInfoDao.find(id); updateOfferInfoDbEntry(dbEntry, offersInfo); return offersInfo; } catch (Exception e) { logger.error( "error updating offers for : " + companyId + " and : " + offersInfo.getBranchId() + " : " + e.getMessage()); throw new Exception( "error updating offers for : " + companyId + " and : " + offersInfo.getBranchId() + " : " + e.getMessage()); } }
@Transactional public OffersInfo addOffersInfo(int companyId, OffersInfo offersInfo) throws Exception { try { int offerId = offersInfoDao.getMaxIdValue(companyId) + 1; OfferInfoDbType offerInfoDbType = Conversions.getOfferInfoDbEntry(companyId, offersInfo.getBranchId(), offerId, offersInfo); offersInfoDao.add(offerInfoDbType); offersInfo.setOfferId(offerId); return offersInfo; } catch (Exception e) { logger.error( "error adding offers for : " + companyId + " and : " + offersInfo.getBranchId() + " : " + e.getMessage()); throw new Exception( "error adding offers for : " + companyId + " and : " + offersInfo.getBranchId() + " : " + e.getMessage()); } }