List of usage examples for org.springframework.transaction.annotation Propagation REQUIRES_NEW
Propagation REQUIRES_NEW
To view the source code for org.springframework.transaction.annotation Propagation REQUIRES_NEW.
Click Source Link
From source file:com.ciphertool.zodiacengine.dao.SolutionDao.java
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) public SolutionChromosome findBySolutionId(Integer solutionId) { Query selectByIdQuery = new Query(Criteria.where("id").is(solutionId)); SolutionChromosome solutionChromosome = mongoOperations.findOne(selectByIdQuery, SolutionChromosome.class); return solutionChromosome; }
From source file:cs544.letmegiveexam.service.QuestionService.java
@Transactional(propagation = Propagation.REQUIRES_NEW) public void addQuestion(Question question) { questionDAO.add(question); }
From source file:cs544.blog.service.BlogService.java
@Override @Transactional(propagation = Propagation.REQUIRES_NEW) public User createUser(String username, String password) { // Transaction tx = sessionFactory.getCurrentSession().beginTransaction(); User user = new User(username, password); userDAO.saveUser(user);//from w w w .j a v a2 s . c o m // tx.commit(); return user; }
From source file:com.ciphertool.zodiacengine.dao.CipherDao.java
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) public List<Cipher> findAll() { List<Cipher> ciphers = mongoOperations.findAll(Cipher.class); return ciphers; }
From source file:com.brienwheeler.lib.db.TransactionWrapper.java
@Transactional(propagation = Propagation.REQUIRES_NEW) public <T> T doInNewWriteTransaction(Callable<T> callable) { try {// w w w . j a v a2s . c om return callable.call(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.healthcit.cacure.dao.BaseJpaDao.java
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW) public void delete(T entity) { em.remove(entity); }
From source file:com.ciphertool.sentencebuilder.dao.WordDao.java
/** * Returns a list of all Words, so words will be duplicated if they have * multiple parts of speech.//from w ww . j a v a 2 s .c o m */ @Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) public List<Word> findAll() { Session session = sessionFactory.getCurrentSession(); @SuppressWarnings("unchecked") List<Word> result = (List<Word>) session.createQuery("from Word").list(); return result; }
From source file:com.orange.clara.cloud.servicedbdumper.task.asynctask.CreateDumpTask.java
@Async @Transactional(propagation = Propagation.REQUIRES_NEW) public Future<Boolean> runTask(Integer jobId) throws AsyncTaskException { Job job = this.jobRepo.findOne(jobId); DatabaseDumpFile databaseDumpFile = null; try {//from w ww .j a va2 s .c o m databaseDumpFile = this.dumper.dump(job.getDbDumperServiceInstance()); if (job.getMetadata() != null) { logger.debug("Adding metadata for dump {}.", databaseDumpFile.getId()); databaseDumpFile.setMetadata(job.getMetadata()); this.databaseDumpFileRepo.save(databaseDumpFile); logger.debug("Finished adding metadata."); } } catch (DumpException e) { logger.error("Cannot create dump for '{}': {}", job.getDatabaseRefSrc().getName(), e.getMessage()); job.setJobEvent(JobEvent.ERRORED); job.setErrorMessage(e.getMessage()); this.databaseRefManager.deleteServiceKey(job); jobRepo.save(job); return new AsyncResult<Boolean>(false); } job.setJobEvent(JobEvent.FINISHED); this.databaseRefManager.deleteServiceKey(job); jobRepo.save(job); return new AsyncResult<Boolean>(true); }
From source file:fr.univrouen.poste.services.EmailService.java
@Transactional(propagation = Propagation.REQUIRES_NEW) public boolean sendMessage(String mailFrom, String mailTo, String subject, String mailMessage) { if (this.isEnabled) { try {/*from w w w . j a v a 2 s . co m*/ mail.setFrom(mailFrom); mail.setTo(mailTo); mail.setSubject(subject); mail.setText(mailMessage); mailSender.send(mail); logger.debug("Email sent : " + mail.toString()); logService.logMail(mailTo, mailMessage, LogService.MAIL_SENT); } catch (Exception e) { logger.error("Email failed : " + mail.toString(), e); logService.logMail(mailTo, mailMessage, LogService.MAIL_FAILED); return false; } } else { logger.warn("sendMessage called but email is not enabled ..."); logger.info("\tmethod call was : sendMessage(" + mailFrom + ", " + mailTo + ", " + subject + ", " + mailMessage + ")"); } return true; }
From source file:architecture.common.i18n.impl.DefaultI18nTextManager.java
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW) public void saveTexts(List<I18nText> list) { List<I18nText> textsToCreate = new ArrayList<I18nText>(); List<I18nText> textsToUpdate = new ArrayList<I18nText>(); List<I18nText> textsToDelete = new ArrayList<I18nText>(); for (I18nText text : list) { if (StringUtils.isEmpty(text.getText())) { if (text.getTextId() != -1L) textsToDelete.add(text); } else if (text.getTextId() == -1L) { textsToCreate.add(text);/*from ww w . j av a 2s. c om*/ } else { textsToUpdate.add(text); } } i18nTextDao.createTexts(textsToCreate); i18nTextDao.updateTexts(textsToUpdate); i18nTextDao.deleteTexts(textsToDelete); reloadResourceBundes(); }