List of usage examples for org.springframework.transaction.annotation Propagation REQUIRED
Propagation REQUIRED
To view the source code for org.springframework.transaction.annotation Propagation REQUIRED.
Click Source Link
From source file:com.newmainsoftech.spray.slingong.datastore.testmodel.book.Author.java
/** * Returned Author model object has preset key. */// w w w. j a v a2s. c o m @Transactional(propagation = Propagation.REQUIRED) public static Author createNewAuthor(String name) { Future<KeyRange> futureKeys = Datastore.allocateIdsAsync(Author.class, 1); Author author = new Author(); author.setName(name); try { author.setKey(futureKeys.get().getStart()); } catch (Throwable throwable) { if (logger.isErrorEnabled()) { logger.error(String.format("Failed to generate key asynchronously for new Author entity.%n" + "Going to attempt to regenrate it synchronously."), throwable); } author.setKey(Datastore.allocateId(Author.class)); } GlobalTransaction gtx = Datastore.getCurrentGlobalTransaction(); gtx.put(author); return author; }
From source file:com.oak_yoga_studio.service.impl.EnrollmentServiceImpl.java
@Transactional(propagation = Propagation.REQUIRED) @Override//from w ww . j a va2 s . c o m public Enrollment getEnrollmentById(int id) { try { return enrollmentDAO.getEnrollment(id); } catch (Exception e) { return null; } }
From source file:com.inkubator.sms.gateway.service.impl.NotificationUserMessagesListener.java
@Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class) public void onMessage(Message message) { try {/* w w w . j av a2s. c om*/ TextMessage textMessage = (TextMessage) message; String json = textMessage.getText(); PasswordHistory passwordHistory = (PasswordHistory) jsonConverter.getClassFromJson(json, PasswordHistory.class); passwordHistory.setPassword(AESUtil.getAESDescription(passwordHistory.getPassword(), SMSGATEWAY.KEYVALUE, SMSGATEWAY.AES_ALGO)); if (Objects.equals(passwordHistory.getEmailNotification(), SMSGATEWAY.EMAIL_NOTIFICATION_NOT_YET_SEND)) { VelocityTempalteModel vtm = new VelocityTempalteModel(); List<String> toSend = new ArrayList<>(); List<String> toSentCC = new ArrayList<String>(); vtm.setFrom(ownerEmail); toSend.add(passwordHistory.getEmailAddress()); vtm.setTo(toSend.toArray(new String[toSend.size()])); vtm.setCc(toSentCC.toArray(new String[toSentCC.size()])); vtm.setBcc(toSentCC.toArray(new String[toSentCC.size()])); vtm.setSubject("User Notification"); Map maptoSend = new HashMap(); if (passwordHistory.getLocalId().equals("en")) { vtm.setTemplatePath("email_user_confirmation_en.vm"); // if (passwordHistory.getRequestType().equalsIgnoreCase(SMSGATEWAY.USER_UPDATE)) { // maptoSend.put("headerInfo", "Your password in OPTIMA HR has been updated. <br/>"); // } if (passwordHistory.getRequestType().equalsIgnoreCase(SMSGATEWAY.USER_NEW)) { maptoSend.put("headerInfo", "Your account in OPTIMA HR already created.<br/>"); } if (passwordHistory.getRequestType().equalsIgnoreCase(SMSGATEWAY.USER_RESET)) { maptoSend.put("headerInfo", "Your Password in OPTIMA HR has been reset. <br/>"); } } System.out.println(" suksesss"); if (passwordHistory.getLocalId().equals("in")) { vtm.setTemplatePath("email_user_confirmation.vm"); // if (passwordHistory.getRequestType().equalsIgnoreCase(SMSGATEWAY.USER_UPDATE)) { // maptoSend.put("headerInfo", "Password Anda pada Aplikasi OPTIMA HR berhasil diubah. <br/>"); // } if (passwordHistory.getRequestType().equalsIgnoreCase(SMSGATEWAY.USER_NEW)) { maptoSend.put("headerInfo", "Anda telah terdaftar di Aplikasi OPTIMA HR <br/>"); } if (passwordHistory.getRequestType().equalsIgnoreCase(SMSGATEWAY.USER_RESET)) { maptoSend.put("headerInfo", "Password Anda pada Aplikasi OPTIMA HR berhasil direset. <br/>"); } } Gson gson = new GsonBuilder().create(); TypeToken<List<String>> token = new TypeToken<List<String>>() { }; List<String> dataRole = gson.fromJson(passwordHistory.getListRole(), token.getType()); maptoSend.put("role", dataRole); maptoSend.put("user", passwordHistory); maptoSend.put("ownerAdministrator", ownerAdministrator); maptoSend.put("ownerCompany", ownerCompany); maptoSend.put("applicationUrl", applicationUrl); maptoSend.put("applicationName", applicationName); try { velocityTemplateSender.sendMail(vtm, maptoSend); } catch (Exception ex) { LOGGER.error("Error", ex); } passwordHistory.setEmailNotification(1); passwordHistory.setPassword(HashingUtils.getHashSHA256(passwordHistory.getPassword())); this.passwordHistoryDao.update(passwordHistory); System.out.println(" suksesss"); } } catch (Exception ex) { LOGGER.error("Error", ex); } }
From source file:com.crm.earnify.services.IGenericEarnifyServiceImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED) public void update(E p_entity_to_update) { this.i_generic_dao.update(p_entity_to_update); }
From source file:it.pronetics.madstore.repository.jcr.impl.JcrEntryRepository.java
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) public String put(final String collectionKey, final Element entryElement) { if (entryElement == null || collectionKey == null || collectionKey.equals("")) { throw new IllegalArgumentException("Parameters cannot be null or empty strings!"); } else if (entryElement.getAttribute(AtomConstants.ATOM_KEY).equals("")) { throw new AtomRepositoryException("The entry element has no key!"); }//from w w w .j a va2 s .co m return (String) jcrTemplate.execute(new JcrCallback() { public Object doInJcr(final Session session) throws IOException, RepositoryException { String entryKey = entryElement.getAttribute(AtomConstants.ATOM_KEY); if (contains(collectionKey, entryKey)) { delete(collectionKey, entryKey); indexManager.delete(collectionKey, entryKey); } importNodeFromDomEntry(collectionKey, entryKey, entryElement, session); indexManager.index(collectionKey, entryKey, entryElement); session.save(); return entryKey; } }); }
From source file:es.ujaen.iambiental.daos.DependenciaDAO.java
/** * Actualiza un dependencia en la BD./* w w w. j a v a2 s. com*/ * * @param dependencia * @throws DependenciaErrorActualizar */ @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = es.ujaen.iambiental.excepciones.SensorErrorActualizar.class) public void actualizar(Dependencia dependencia) throws DependenciaErrorActualizar { try { em.merge(dependencia); em.flush(); } catch (Exception e) { throw new DependenciaErrorActualizar(); } }
From source file:org.watterssoft.appsupport.ticket.service.TicketService.java
@Transactional(propagation = Propagation.REQUIRED, readOnly = true) public Ticket getTicketById(long ticketId) { return ticketDao.findById(ticketId); }
From source file:com.github.carlomicieli.service.hibernate.PlayerServiceImpl.java
/** * Delete a player./* w ww .j av a2s.c om*/ * @param player the player. */ @Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public void deletePlayer(Player player) { getDAO().deletePlayer(player); }
From source file:no.dusken.barweb.service.impl.InvoiceTransaksjonServiceImpl.java
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false) public void deleteInvoiceUpdateTransaksjons(Invoice invoice, List<Transaksjon> transaksjons) { for (Transaksjon t : transaksjons) { t.setInvoice(null);//from w w w . ja va2 s.c o m transaksjonService.save(t); } invoiceService.delete(invoice); }
From source file:org.opencron.server.dao.BaseDao.java
/** * ?/*www . j av a 2 s.c o m*/ */ @SuppressWarnings({ "hiding" }) @Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public <T> T save(T entity) { return super.save(entity); }