List of usage examples for org.springframework.transaction.annotation Propagation MANDATORY
Propagation MANDATORY
To view the source code for org.springframework.transaction.annotation Propagation MANDATORY.
Click Source Link
From source file:com.oak_yoga_studio.dao.impl.EnrollmentDAOImpl.java
@Transactional(propagation = Propagation.MANDATORY) @Override/*w w w .j ava 2 s . com*/ public boolean checkSeatAvailablity(int sectionID) { Query query = sf.getCurrentSession() .createQuery("select availableSeat from Section s where s.id=:sectionID"); query.setParameter("sectionID", sectionID); int availableSeats = 0; availableSeats = (Integer) query.uniqueResult(); if (availableSeats > 0) { return true; } else { return false; } }
From source file:org.cleverbus.core.common.dao.ExternalCallDaoJpaImpl.java
@Override @Transactional(propagation = Propagation.MANDATORY) public void lockExternalCall(ExternalCall extCall) throws PersistenceException { Assert.notNull(extCall, "the extCall must not be null"); Assert.isTrue(extCall.getState() != ExternalCallStateEnum.PROCESSING, "the extCall must not be locked in a processing state"); Assert.isTrue(em.contains(extCall), "the extCall must be attached"); // note: https://blogs.oracle.com/carolmcdonald/entry/jpa_2_0_concurrency_and em.lock(extCall, LockModeType.OPTIMISTIC); extCall.setState(ExternalCallStateEnum.PROCESSING); }
From source file:com.epam.catgenome.dao.vcf.VcfFileDao.java
/** * Persists {@code VcfFile} record to the database * * @param vcfFile a {@code VcfFile} instance to be persisted *//*from ww w . ja v a 2 s.co m*/ @Transactional(propagation = Propagation.MANDATORY) public void createVcfFile(VcfFile vcfFile, final Long realId) { vcfFile.setBioDataItemId(vcfFile.getId()); vcfFile.setId(realId); getNamedParameterJdbcTemplate().update(createVcfFileQuery, BiologicalDataItemDao.FeatureFileParameters .getLinkedTableParameters(VcfParameters.VCF_ID.name(), vcfFile)); }
From source file:com.epam.catgenome.dao.gene.GeneFileDao.java
/** * Persists {@code GeneFile} record to the database * @param geneFile a {@code GeneFile} instance to be persisted */// w w w . j av a2s . c o m @Transactional(propagation = Propagation.MANDATORY) public void createGeneFile(GeneFile geneFile) { getNamedParameterJdbcTemplate().update(createGeneFileQuery, BiologicalDataItemDao.FeatureFileParameters .getLinkedTableParameters(GeneParameters.GENE_ITEM_ID.name(), geneFile)); }
From source file:net.dontdrinkandroot.persistence.dao.GenericJpaDao.java
@Override @Transactional(propagation = Propagation.MANDATORY, readOnly = true) public <E extends Entity<K>, K> List<E> findAll(final Class<E> clazz) { final CriteriaBuilder builder = this.getCriteriaBuilder(); final CriteriaQuery<E> criteriaQuery = builder.createQuery(clazz); criteriaQuery.from(clazz);/*from www . j a va 2 s . c om*/ return this.find(criteriaQuery); }
From source file:cz.zcu.kiv.eegdatabase.logic.indexing.IndexingServiceImpl.java
/** * Performs indexing of the whole database. * @throws IllegalAccessException//w ww .java2 s. c om * @throws InstantiationException * @throws NoSuchMethodException * @throws IOException * @throws SolrServerException */ @Async @Transactional(propagation = Propagation.MANDATORY) public void indexDatabase() throws IllegalAccessException, SolrServerException, IOException, NoSuchMethodException, InstantiationException { // get required dao beans Set<Class<? extends GenericDao>> daoClasses = IndexingUtils.getDaosForIndexing(); for (Class<? extends GenericDao> daoClass : daoClasses) { log.debug("class: " + daoClass.getName()); List daoRecords = applicationContext.getBean(daoClass).getAllRecordsFull(); indexer.indexAll(daoRecords); } }
From source file:ru.org.linux.user.UserLogDao.java
@Transactional(rollbackFor = Exception.class, propagation = Propagation.MANDATORY) public void logBlockUser(@Nonnull User user, @Nonnull User moderator, @Nonnull String reason) { jdbcTemplate.update(//from w w w. ja va 2s . co m "INSERT INTO user_log (userid, action_userid, action_date, action, info) VALUES (?,?,CURRENT_TIMESTAMP, ?::user_log_action, ?)", user.getId(), moderator.getId(), UserLogAction.BLOCK_USER.toString(), ImmutableMap.of(OPTION_REASON, reason)); }
From source file:fi.helsinki.opintoni.service.usefullink.UsefulLinkService.java
@Transactional(propagation = Propagation.MANDATORY) public void createUserDefaultUsefulLinks(User user, AppUser appUser) { if (appUser.isTeacher()) { teacherDefaultUsefulLinksService.createDefaultLinks(user, appUser); } else {/* www .ja va2 s . com*/ studentDefaultUsefulLinksService.createDefaultLinks(user, appUser); } }
From source file:com.epam.catgenome.dao.DaoHelper.java
/** * Generates and returns the next value for a sequence with the given name. * * @param sequenceName {@code String} specifies full-qualified name of sequence which * next value should be returned by a call * @return {@code Long}//from w w w . ja v a2 s . co m * @throws IllegalArgumentException will be thrown if the provided <tt>sequenceName</tt> * id <tt>null</tt> or empty string */ @Transactional(propagation = Propagation.MANDATORY) public Long createId(final String sequenceName) { Assert.isTrue(StringUtils.isNotBlank(sequenceName)); return getNamedParameterJdbcTemplate().queryForObject(createIdQuery, new MapSqlParameterSource(HelperParameters.SEQUENCE_NAME.name(), sequenceName), Long.class); }
From source file:net.dontdrinkandroot.persistence.dao.TypedJpaDao.java
@Override @Transactional(propagation = Propagation.MANDATORY, readOnly = true) public List<E> findAll(final SingularAttribute<? super E, ?> attribute, final boolean asc, final int firstResult, final int maxResults) { final CriteriaBuilder builder = this.getCriteriaBuilder(); final CriteriaQuery<E> criteriaQuery = builder.createQuery(this.entityClass); final Root<E> from = criteriaQuery.from(this.entityClass); if (attribute != null) { if (asc) { criteriaQuery.orderBy(builder.asc(from.get(attribute))); } else {//w w w . j a va2 s .c o m criteriaQuery.orderBy(builder.desc(from.get(attribute))); } } return this.find(criteriaQuery, firstResult, maxResults); }