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.mycompany.capstone.dao.CommentDaoDbImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED) public void update(Comment comment) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
From source file:com.thesoftwareguild.dvdlibrary.dao.DvdLibraryDaoDbImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public Dvd addDvd(Dvd dvd) { jdbcTemplate.update(SQL_INSERT_DVD, dvd.getTitle(), dvd.getReleased(), dvd.getMpaa(), dvd.getDirector(), dvd.getStudio(), dvd.getRating(), dvd.getNote()); dvd.setDvdId(jdbcTemplate.queryForObject("select LAST_INSERT_ID()", Integer.class)); return dvd;/*from w w w.ja va 2s. c om*/ }
From source file:org.openregistry.core.service.DefaultIdentifierChangeService.java
@Transactional(propagation = Propagation.REQUIRED, noRollbackFor = IllegalArgumentException.class) public boolean change(Identifier internalId, String changedId) { //check if both identifier are of the same type if (internalId == null || StringUtils.isEmpty(changedId)) { throw new IllegalArgumentException("new or old identifer couldn't be null"); }//from www . j a v a 2 s . c o m if (internalId.getValue().equals(changedId)) { logger.debug("new identifier is the same no need to change existing identifier"); return false; } final Person person = this.findPersonByIdentifier(internalId.getType().getName(), internalId.getValue()); if (person == null) throw new IllegalArgumentException( format("The person with the provided identifier [%s] does not exist", internalId.getValue())); final Person person2 = this.findPersonByIdentifier(internalId.getType().getName(), changedId); if (person2 != null && person.getId() != person2.getId()) { throw new IllegalArgumentException( format("The person with the proposed new identifier [%s] already exists.", changedId)); } Map<String, Identifier> primaryIds = person.getPrimaryIdentifiersByType(); Identifier currId = primaryIds.get(internalId.getType().getName()); if (currId == null) throw new IllegalStateException("Provided Id doesnt exist as primary identifier "); if (currId.getValue().equals(changedId)) { logger.debug( format("The provided new primary identifier [%s] already assigned to the person.", changedId)); } else if (!currId.getValue().equals(internalId.getValue())) { throw new IllegalArgumentException( format("The provided primary identifier [%s] does not match the current primary identifier", internalId.getValue())); } //check if the provided new identifier is already there, and if so, do the update, otherwise - do the insert. Identifier providedId = person.findIdentifierByValue(internalId.getType().getName(), changedId); if (providedId == null) { providedId = person.addIdentifier(internalId.getType(), changedId); } providedId.setPrimary(true); providedId.setDeleted(false); currId.setPrimary(false); currId.setDeleted(true); return true; }
From source file:com.crowdmobile.dao.imp.GenericDAO.java
@Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public T merge(T entity) throws Exception { getHibernateTemplate().merge(entity); getHibernateTemplate().flush();// w ww . j a va2s. co m return entity; }
From source file:com.oak_yoga_studio.service.impl.CustomerServiceImpl.java
@Transactional(propagation = Propagation.REQUIRED) @Override/*from www . j a v a 2 s . c o m*/ public Customer getCustomerById(int id) { try { return this.customerDAO.getCustomer(id); } catch (Exception e) { return null; } }
From source file:com.tsguild.videogamewebapp.dao.VideoGameDaoDbImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public VideoGame addVideoGame(VideoGame videoGame) { jdbcTemplate.update(SQL_INSERT_GAME, videoGame.getTitle(), videoGame.getPublisher(), videoGame.getGenre(), videoGame.isIsMultiplayer(), videoGame.getEsrbRating()); videoGame.setId(jdbcTemplate.queryForObject("SELECT LAST_INSERT_ID()", Integer.class)); return videoGame; }
From source file:com.tsg.techsupportmvc.dao.MessageBoardDaoDbImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public MessageBoardMessage addMessage(MessageBoardMessage message) { jdbcTemplate.update(SQL_INSERT_MESSAGE, message.getUserId_FK(), message.getTitle(), message.getSubmittedDate(), message.getMessageBody()); message.setMessageId(jdbcTemplate.queryForObject("SELECT LAST_INSERT_ID()", Integer.class)); return message; }
From source file:com.webfileanalyzer.service.impl.FileStatisticServiceImpl.java
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Override public void delete(FileStatistic dbFile) { clearCache(); fileStatisticDAO.delete(dbFile); }
From source file:com.mycompany.dvdmvc.dao.NotesDaoDbImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED) public void update(Note note) { jdbcTemplate.update(SQL_UPDATE_NOTE, note.getMovieId(), note.getNote(), note.getId()); }
From source file:org.fits.proweb.business.UserRoleComponent.java
@Transactional(propagation = Propagation.REQUIRED) public Map<String, String> mapLoginRole() { return userRoleDao.mapLoginRole(); }