List of usage examples for org.springframework.transaction.support DefaultTransactionDefinition DefaultTransactionDefinition
public DefaultTransactionDefinition()
From source file:com.siblinks.ws.service.impl.CommentServiceImpl.java
/** * {@inheritDoc}//w w w.j a va 2s. c o m */ @Override @RequestMapping(value = "/addCommentVideoAdmission", method = RequestMethod.POST) public ResponseEntity<Response> addCommentVideoAdmission(@RequestBody final RequestData request) { SimpleResponse simpleResponse = null; TransactionStatus statusDB = null; try { String content = request.getRequest_data().getContent(); if (content != null && content.length() > 1024) { simpleResponse = new SimpleResponse(SibConstants.FAILURE, MSG_LONGER_THAN_1024); } else { if (!AuthenticationFilter.isAuthed(context)) { simpleResponse = new SimpleResponse(SibConstants.FAILURE, "Authentication required."); return new ResponseEntity<Response>(simpleResponse, HttpStatus.FORBIDDEN); } String authorId = request.getRequest_data().getAuthorID(); String authorName = request.getRequest_data().getAuthor(); String vId = request.getRequest_data().getVid(); if (StringUtil.isNull(content) || StringUtil.isNull(authorId) || StringUtil.isNull(vId)) { simpleResponse = new SimpleResponse(SibConstants.FAILURE, request.getRequest_data_type(), request.getRequest_data_method(), "Comment content is not empty"); return new ResponseEntity<Response>(simpleResponse, HttpStatus.OK); } boolean flag = true; TransactionDefinition def = new DefaultTransactionDefinition(); statusDB = transactionManager.getTransaction(def); String strContent = CommonUtil.filterWord(content, cachedDao.getAllWordFilter()); Object[] queryParams = { authorName, authorId, strContent }; long commentId = dao.insertObject(SibConstants.SqlMapper.SQL_SIB_ADD_COMMENT, queryParams); if (commentId > 0) { Object[] queryParamsIns = { vId, commentId }; flag = dao.insertUpdateObject(SibConstants.SqlMapper.SQL_SIB_INSERT_VIDEO_ADMISSION_COMMENT, queryParamsIns); // Update number comment into video adminission table. if (flag) { flag = dao.insertUpdateObject(SibConstants.SqlMapper.SQL_UPDATE_NUMCOMMENT_VIDEO_ADMISSION, new Object[] { vId }); } } transactionManager.commit(statusDB); simpleResponse = new SimpleResponse("" + flag, request.getRequest_data_type(), request.getRequest_data_method(), (flag) ? "Add comment successful" : "Add comment failure"); } } catch (Exception e) { e.printStackTrace(); if (statusDB != null) { transactionManager.rollback(statusDB); } simpleResponse = new SimpleResponse(SibConstants.FAILURE, e.getMessage()); } return new ResponseEntity<Response>(simpleResponse, HttpStatus.OK); }
From source file:com.poscoict.license.service.BoardService.java
public void modifyBoard(HttpSession session, String category, String openFlag, String title, String content, String contentNo, String subCategory, MultipartFile[] boardAttach, String[] deleteFile) throws UserException { logger.info("modifyBoard: category= " + category + " contentNo= " + contentNo); TransactionStatus status = this.transactionManager.getTransaction(new DefaultTransactionDefinition()); Board board = new Board(); board.setORI_FOLDER_ID(category);/* w w w. ja v a2s . c o m*/ board.setUSER_NO((String) session.getAttribute("USER_NO")); board.setOPEN_FLAG(openFlag); board.setTITLE(title); board.setMAIN_CONTENT(content.replaceAll("'", "'")); board.setCONTENT_NO(Integer.parseInt(contentNo)); board.setR_MODIFY_DATE(dateFormat()); board.setR_MODIFY_USER((String) session.getAttribute("USER_NO")); board.setSUBCATEGORY(subCategory); ArrayList<Map<String, Object>> attachList = new ArrayList<Map<String, Object>>(); try { // userDao.modifyBoard(board); // ? ? if (boardAttach.length > 0) { for (int i = 0; i < boardAttach.length; i++) { Map<String, Object> attach = new HashMap<String, Object>(); String attachPath = Consts.BOARD_ATTACH_FILE_HOME; attachPath += category + File.separator + attachDateFormat() + File.separator + attachFileDateFormat(); attach.put("fileName", boardAttach[i].getOriginalFilename()); int attachSize = (int) boardAttach[i].getSize(); if (attachSize == 0) continue; if (attachSize > 100 * 1024 * 1000) throw new UserException("? ? 100MB ."); attachPath += "(" + (i + 1) + ")"; if (boardAttach[i].getOriginalFilename().lastIndexOf(".") != -1) { attachPath += boardAttach[i].getOriginalFilename() .substring(boardAttach[i].getOriginalFilename().lastIndexOf(".")); } String objectId = "at_" + attachFileDateFormat() + i; objectId += UUID.randomUUID().toString().replaceAll("-", "").substring(0, 12); attach.put("filePath", attachPath); attach.put("fileSize", attachSize); attach.put("objectId", objectId); attachList.add(attach); System.out.println( "up: fileName: " + boardAttach[i].getOriginalFilename() + " attachPath: " + attachPath); try { File ufile = new File(attachPath); if (!ufile.exists()) { ufile.mkdirs(); } boardAttach[i].transferTo(ufile); userDao.setAttachFileInfo(Integer.parseInt(contentNo), category, attachList.get(i).get("objectId").toString(), attachList.get(i).get("fileName").toString(), attachList.get(i).get("filePath").toString(), Integer.parseInt(attachList.get(i).get("fileSize").toString()), (String) session.getAttribute("USER_NO")); } catch (IOException e) { e.printStackTrace(); try { throw new IOException("? ? "); } catch (IOException e1) { e1.printStackTrace(); } } } } // ? if (deleteFile != null) { for (int i = 0; i < deleteFile.length; i++) { String deleteAttachFilePath = userDao.getAttachFilePath(deleteFile[i]); logger.info("deleteAttachFilePath: " + deleteAttachFilePath); File file = new File(deleteAttachFilePath); if (file.exists() == true) file.delete(); userDao.deleteAttachFile(deleteFile[i]); } } transactionManager.commit(status); } catch (Exception e) { logger.error("userDao.modifyBoard: ", e); transactionManager.rollback(status); throw new UserException(" "); } logger.info("modifyBoard-success"); }
From source file:com.krawler.esp.handlers.zohoRequestHandler.java
public String saveUpdateZohoPotentials(String username, String password, String authToken, String userid, String companyid) {//from w w w . j a v a 2 s .c om // Session s = zohoRequestDAO.getCurrentSession(); String result = "{success:false,recCount:0,totalRecords:0}"; int recCount = 0; DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setName("JE_Tx"); def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED); TransactionStatus status = txnManager.getTransaction(def); try { String Hql = "from CrmOpportunity c where c.oppid= ?"; JSONObject jobj = getRecordJson("Potentials", username, password, authToken); //Potential , Leads, Accounts if (jobj.get("success").equals(true)) { JSONArray dataArray = jobj.getJSONArray("data"); for (int cnt = 0; cnt < dataArray.length(); cnt++) { // Transaction tx = (Transaction) s.beginTransaction(); JSONObject recObj = dataArray.getJSONObject(cnt); List existingPotential = zohoRequestDAO.executeQuery(Hql, new Object[] { recObj.get("POTENTIALID") }); String masterData = "FROM CrmCombodata c where c.crmCombomaster.masterid=?"; List masterdata = zohoRequestDAO.executeQuery(masterData, new Object[] { "d49609c2-0abc-47ce-8d5a-5850c03b7291" }); Iterator itr = masterdata.iterator(); HashMap combodata = new HashMap(); while (itr.hasNext()) { CrmCombodata cdata = (CrmCombodata) itr.next(); combodata.put(cdata.getRawvalue().toLowerCase(), cdata.getValueid()); } Object stagevalue = combodata.get(recObj.getString("Stage").toLowerCase()); DefaultMasterItem dmasterItem = null; if (stagevalue == null) { stagevalue = combodata.get("prospecting"); Company companyObj = (Company) zohoRequestDAO.get(Company.class, companyid); CrmCombomaster crmComboMasterObj = (CrmCombomaster) zohoRequestDAO.get(CrmCombomaster.class, "d49609c2-0abc-47ce-8d5a-5850c03b7291"); dmasterItem = new DefaultMasterItem(); dmasterItem.setMainID(""); dmasterItem.setCompany(companyObj); dmasterItem.setID(UUID.randomUUID().toString()); dmasterItem.setCrmCombomaster(crmComboMasterObj); dmasterItem.setValue(recObj.getString("Stage")); } else { String dmasteritemid = "from DefaultMasterItem d where d.crmCombodata.valueid = ? and d.company.companyID=?"; List templist = zohoRequestDAO.executeQuery(dmasteritemid, new Object[] { stagevalue, companyid }); itr = templist.iterator(); while (itr.hasNext()) { dmasterItem = (DefaultMasterItem) itr.next(); } } JSONObject oppJObj = new JSONObject(); oppJObj.put("oppid", recObj.get("POTENTIALID")); oppJObj.put("companyid", companyid); oppJObj.put("userid", userid); oppJObj.put("updatedon", new Date()); oppJObj.put("oppname", recObj.getString("Potential Name").equals("null") ? "" : recObj.getString("Potential Name")); oppJObj.put("oppownerid", userid); oppJObj.put("opptypeid", "0"); oppJObj.put("currencyid", "0"); oppJObj.put("oppstageid", dmasterItem.getID()); oppJObj.put("isarchive", false); oppJObj.put("deleteflag", 0); CrmAccount ca = null; try { ca = (CrmAccount) zohoRequestDAO.get(CrmAccount.class, recObj.get("ACCOUNTID").toString()); } catch (Exception e) { logger.warn(e.getMessage(), e); } if (ca != null) { oppJObj.put("accountnameid", recObj.get("ACCOUNTID")); } // String timeFormatId = sessionHandlerImpl.getUserTimeFormat(request); // String timeZoneDiff = sessionHandlerImpl.getTimeZoneDifference(request); // if(recObj.has("closedate") && ! recObj.getString("Closing Date").equals("")){ // oppJObj.put("closedate",authHandler.getDateFormatter(timeFormatId, timeZoneDiff).parse(recObj.getString("Closing Date").toString())); // } java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); java.util.Date closingdate = null; if (!StringUtil.isNullOrEmpty(recObj.getString("Closing Date"))) { closingdate = sdf.parse(recObj.getString("Closing Date").toString()); oppJObj.put("closingdate", closingdate.getTime()); } oppJObj.put("validflag", 1); if (existingPotential.size() > 0) { KwlReturnObject kmsg = crmOpportunityDAOObj.editOpportunities(oppJObj); } else { // oppJObj.put("createdon", new Date()); KwlReturnObject kmsg = crmOpportunityDAOObj.addOpportunities(oppJObj); } // tx.commit(); recCount++; } txnManager.commit(status); result = "{success:true,recCount:" + recCount + ",totalRecords:" + jobj.get("recordCount") + "}"; } } catch (ServiceException ex) { logger.warn(ex.getMessage(), ex); txnManager.rollback(status); } catch (JSONException ex) { logger.warn(ex.getMessage(), ex); txnManager.rollback(status); } catch (Exception ex) { logger.warn(ex.getMessage(), ex); } finally { // s.close(); return result; } }
From source file:com.krawler.spring.crm.accountModule.crmAccountController.java
public ModelAndView newAccount(HttpServletRequest request, HttpServletResponse response) throws ServletException { JSONObject myjobj = new JSONObject(); JSONObject jobj = new JSONObject(); KwlReturnObject kmsg = null;/*from w w w . ja v a2 s .co m*/ CrmAccount acc = null; //Create transaction DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setName("JE_Tx"); def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED); TransactionStatus status = txnManager.getTransaction(def); try { String userid = request.getParameter("userid"); String accountname = request.getParameter("accountname"); String website = request.getParameter("website"); String description = request.getParameter("description"); String contactno = request.getParameter("contactno"); String revenue = request.getParameter("revenue"); String id = java.util.UUID.randomUUID().toString(); String companyid = sessionHandlerImpl.getCompanyid(request); jobj.put("accountid", id); jobj.put("accountownerid", userid); jobj.put("companyid", companyid); jobj.put("userid", userid); jobj.put("accountname", accountname); jobj.put("revenue", revenue); jobj.put("phone", contactno); jobj.put("description", description); jobj.put("website", website); jobj.put("validflag", 1); jobj.put("tzdiff", sessionHandlerImpl.getTimeZoneDifference(request)); // jobj.put("createdon", new Date()); kmsg = crmAccountDAOObj.addAccounts(jobj); acc = (CrmAccount) kmsg.getEntityList().get(0); myjobj.put("success", true); myjobj.put("ID", acc.getAccountid()); myjobj.put("validflag", acc.getValidflag()); myjobj.put("accountname", acc.getAccountname()); txnManager.commit(status); } catch (JSONException e) { System.out.println(e.getMessage()); txnManager.rollback(status); } catch (Exception e) { System.out.println(e.getMessage()); txnManager.rollback(status); } return new ModelAndView("jsonView", "model", myjobj.toString()); }
From source file:es.tid.fiware.rss.dao.impl.test.DbeTransactionDaoImplTest.java
@Test @Transactional(propagation = Propagation.SUPPORTS) public void testDeleteTransactionsByProviderId() { String txTransactionId = new String("1234"); String providerId = new String("provider"); DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setPropagationBehavior(Propagation.REQUIRES_NEW.value()); TransactionStatus status = transactionManager.getTransaction(def); dbeTransactionDAO.deleteTransactionsByProviderId(providerId); transactionManager.commit(status);//from ww w . j av a 2s .c o m List<DbeTransaction> listDbeTr = dbeTransactionDAO.getTransactionsByProviderId(providerId); if (listDbeTr != null && listDbeTr.size() > 0) { DbeTransactionDaoImplTest.LOGGER.debug("looking result list data...."); DbeTransactionDaoImplTest.LOGGER.error("Obtained:" + listDbeTr.get(0).getTxTransactionId()); Assert.assertTrue("0 data obtained ", (listDbeTr.get(0).getTxTransactionId()).equals(txTransactionId)); } else { DbeTransactionDaoImplTest.LOGGER.debug("Obtained 0 data is not possible with datatest values"); Assert.assertTrue("0 data obtained ", true); } }
From source file:com.siblinks.ws.service.impl.CommentServiceImpl.java
/** * {@inheritDoc}/*w w w. ja v a2 s .c om*/ */ @Override @RequestMapping(value = "/deleteComment", method = RequestMethod.POST) public ResponseEntity<Response> deleteComment(@RequestBody final RequestData request) { Object[] queryParams = { request.getRequest_data().getCid() }; TransactionDefinition def = new DefaultTransactionDefinition(); TransactionStatus status = transactionManager.getTransaction(def); SimpleResponse reponse = null; try { dao.insertUpdateObject(SibConstants.SqlMapperBROT163.SQL_DELETE_COMMENT_VIDEO, queryParams); dao.insertUpdateObject(SibConstants.SqlMapper.SQL_DELETE_COMMENT, queryParams); transactionManager.commit(status); reponse = new SimpleResponse("" + status, request.getRequest_data_type(), request.getRequest_data_method(), "Success"); } catch (Exception e) { e.printStackTrace(); transactionManager.rollback(status); reponse = new SimpleResponse("" + status, request.getRequest_data_type(), request.getRequest_data_method(), "Failed"); } return new ResponseEntity<Response>(reponse, HttpStatus.OK); }
From source file:com.krawler.spring.crm.accountModule.crmAccountController.java
public ModelAndView repAccount(HttpServletRequest request, HttpServletResponse response) throws ServletException { JSONObject myjobj = new JSONObject(); String jsondata = request.getParameter("val"); KwlReturnObject kmsg = null;/*from w w w . j a va2s. com*/ CrmAccount acc = null; JSONObject jobj; //Create transaction DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setName("JE_Tx"); def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED); TransactionStatus status = txnManager.getTransaction(def); try { jobj = new JSONObject(jsondata); JSONArray jarr = new JSONArray(); jarr = jobj.getJSONArray("userdata"); for (int ctr = 0; ctr < jarr.length(); ctr++) { jobj = jarr.getJSONObject(ctr); String contactno = jobj.getString("contactno"); jobj.put("phone", contactno); jobj.put("tzdiff", sessionHandlerImpl.getTimeZoneDifference(request)); kmsg = crmAccountDAOObj.editAccounts(jobj); acc = (CrmAccount) kmsg.getEntityList().get(0); } myjobj.put("success", true); myjobj.put("ID", acc.getAccountid()); txnManager.commit(status); } catch (JSONException e) { System.out.println(e.getMessage()); txnManager.rollback(status); } catch (Exception e) { System.out.println(e.getMessage()); txnManager.rollback(status); } return new ModelAndView("jsonView", "model", myjobj.toString()); }
From source file:com.siblinks.ws.service.impl.VideoServiceImpl.java
/** * * @param vid/* www.ja va2s .c om*/ * @param authorId * @return */ private boolean deleteVideo(final String vid, final String authorId) { boolean flag = false; TransactionStatus status = null; try { TransactionDefinition def = new DefaultTransactionDefinition(); status = transactionManager.getTransaction(def); Object[] queryParams = new Object[] { vid }; // delete video from Video_Comment String entityName = SibConstants.SqlMapperBROT43.SQL_DELETE_VIDEO_COMMENT; dao.insertUpdateObject(entityName, queryParams); // delete video from Video_Like // entityName = SibConstants.SqlMapperBROT43.SQL_DELETE_VIDEO_LIKE; // dao.insertUpdateObject(entityName, queryParams); // delete video from Video_Notes entityName = SibConstants.SqlMapperBROT43.SQL_DELETE_VIDEO_NOTE; dao.insertUpdateObject(entityName, queryParams); // delete video from Video_Tag entityName = SibConstants.SqlMapperBROT43.SQL_DELETE_VIDEO_TAG; dao.insertUpdateObject(entityName, queryParams); // delete video from Video_Rating entityName = SibConstants.SqlMapperBROT43.SQL_DELETE_VIDEO_RATING; dao.insertUpdateObject(entityName, queryParams); // delete video from Video_Playlist entityName = SibConstants.SqlMapperBROT43.SQL_DELETE_VIDEO_PLAYLIST; dao.insertUpdateObject(entityName, queryParams); // delete video from Video_Subscribe entityName = SibConstants.SqlMapperBROT43.SQL_GET_STUDENT_SUBSCRIBE; queryParams = new Object[] { authorId }; List<Object> readObject = dao.readObjects(entityName, queryParams); if (!CollectionUtils.isEmpty(readObject)) { entityName = SibConstants.SqlMapperBROT43.SQL_DELETE_VIDEO_SUBCRIBLE; for (Object object : readObject) { JsonObject json = new JsonParser().parse(object.toString()).getAsJsonObject(); long studentId = json.get("studentid").getAsLong(); queryParams = new Object[] { vid + ",", authorId, studentId }; dao.insertUpdateObject(entityName, queryParams); } } // delete video from Video queryParams = new Object[] { vid }; entityName = SibConstants.SqlMapperBROT43.SQL_DELETE_VIDEO; dao.insertUpdateObject(entityName, queryParams); transactionManager.commit(status); logger.info("Delete Video success " + new Date()); flag = true; } catch (Exception e) { e.printStackTrace(); if (status != null) { transactionManager.rollback(status); } flag = false; } return flag; }
From source file:org.ohmage.query.impl.DocumentQueries.java
public void updateDocument(final String documentId, final byte[] contents, final String name, final String description, final Document.PrivacyState privacyState, final Map<String, Document.Role> campaignAndRolesToAdd, final List<String> campaignsToRemove, final Map<String, Document.Role> classAndRolesToAdd, final Collection<String> classesToRemove, final Map<String, Document.Role> userAndRolesToAdd, final Collection<String> usersToRemove) throws DataAccessException { // Begin transaction DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setName("Document update."); try {/*w w w . j a va2 s.c o m*/ PlatformTransactionManager transactionManager = new DataSourceTransactionManager(getDataSource()); TransactionStatus status = transactionManager.getTransaction(def); try { updateName(documentId, name); updateDescription(documentId, description); updatePrivacyState(documentId, privacyState); // Update the campaign-document roles. updateEntityRoleList(documentId, campaignAndRolesToAdd, campaignsToRemove, SQL_INSERT_CAMPAIGN_ROLE, SQL_UPDATE_CAMPAIGN_ROLE, SQL_DELETE_CAMPAIGN_ROLE); // Update the class-document roles. updateEntityRoleList(documentId, classAndRolesToAdd, classesToRemove, SQL_INSERT_CLASS_ROLE, SQL_UPDATE_CLASS_ROLE, SQL_DELETE_CLASS_ROLE); // Update the user-document roles. updateEntityRoleList(documentId, userAndRolesToAdd, usersToRemove, SQL_INSERT_USER_ROLE, SQL_UPDATE_USER_ROLE, SQL_DELETE_USER_ROLE); // Update the contents last, so if there are any problems with // the other actions, then we fail before we write to the // system. updateContents(documentId, contents); } catch (IllegalArgumentException e) { // Rollback transaction and throw a DataAccessException. transactionManager.rollback(status); throw new DataAccessException("Error while executing the update.", e); } catch (CacheMissException e) { transactionManager.rollback(status); throw new DataAccessException("Error while reading from the cache.", e); } catch (org.springframework.dao.DataAccessException e) { transactionManager.rollback(status); throw e; } // Commit transaction. try { transactionManager.commit(status); } catch (TransactionException e) { transactionManager.rollback(status); throw new DataAccessException("Error while committing the transaction.", e); } } catch (TransactionException e) { throw new DataAccessException("Error while rolling back the transaction.", e); } }
From source file:com.krawler.spring.crm.accountModule.crmAccountController.java
public ModelAndView deleteAccount(HttpServletRequest request, HttpServletResponse response) throws ServletException { JSONObject myjobj = null;/*w w w.j a v a2s. co m*/ KwlReturnObject kmsg = null; CrmAccount acc = null; //Create transaction DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setName("JE_Tx"); def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED); TransactionStatus status = txnManager.getTransaction(def); try { String userid = sessionHandlerImpl.getUserid(request); String timeZoneDiff = sessionHandlerImpl.getTimeZoneDifference(request); myjobj = new JSONObject(); myjobj.put("success", false); JSONArray jarr = null; if (request.getAttribute("deletejarr") != null) { jarr = (JSONArray) request.getAttribute("deletejarr"); } else { String jsondata = request.getParameter("jsondata"); jarr = new JSONArray("[" + jsondata + "]"); } ArrayList accountids = new ArrayList(); for (int i = 0; i < jarr.length(); i++) { JSONObject jobject = jarr.getJSONObject(i); accountids.add(jobject.getString("accid").toString()); } String[] arrayid = (String[]) accountids.toArray(new String[] {}); JSONObject jobj = new JSONObject(); jobj.put("deleteflag", 1); jobj.put("accountid", arrayid); jobj.put("userid", userid); jobj.put("updatedon", new Date().getTime()); jobj.put("tzdiff", timeZoneDiff); kmsg = crmAccountDAOObj.updateMassAccount(jobj); List<CrmAccount> ll = crmAccountDAOObj.getAccounts(accountids); if (ll != null) { for (int i = 0; i < ll.size(); i++) { CrmAccount accountaudit = (CrmAccount) ll.get(i); if (accountaudit.getValidflag() == 1) { auditTrailDAOObj.insertAuditLog(AuditAction.ACCOUNT_DELETE, accountaudit.getAccountname() + " - Account deleted ", request, accountaudit.getAccountid()); } } } if (request.getAttribute("failDelete") != null) { myjobj.put("failDelete", (JSONArray) request.getAttribute("failDelete")); } myjobj.put("successDeleteArr", jarr); myjobj.put("success", true); myjobj.put("ID", accountids.toArray()); txnManager.commit(status); JSONObject cometObj = new JSONObject(); cometObj.put("ids", jarr); publishAccountModuleInformation(request, cometObj, CrmPublisherHandler.DELETERECORDCODE, sessionHandlerImpl.getCompanyid(request), userid); } catch (JSONException e) { System.out.println(e.getMessage()); txnManager.rollback(status); } catch (Exception e) { System.out.println(e.getMessage()); txnManager.rollback(status); } return new ModelAndView("jsonView", "model", myjobj.toString()); }