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.sonoport.service.account.jpa.UserServiceImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED) public void save(User user) { if (user.getId() == null) { entityManager.persist(user);//from w w w. java 2 s . c om } else { entityManager.merge(user); } }
From source file:com.lewischooman.services.IMovieShowSrv.java
@Transactional(value = "txManager", propagation = Propagation.REQUIRED)
MovieDB getMovieByDateMovieId(Date dateFrom, Date dateTo, Integer movieId);
From source file:uk.ac.ebi.intact.editor.services.admin.HqlQueryService.java
@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED) public <T> List<T[]> runNativeQuery(int maxResults, String sqlQuery) { maxResults = Math.min(maxResults, MAX_RESULTS); EntityManager em = getIntactDao().getEntityManager(); Query query = em.createNativeQuery(sqlQuery); query.setMaxResults(maxResults);//from w w w . j a v a2s . c o m return query.getResultList(); }
From source file:com.inkubator.sms.gateway.service.impl.SchedullerSendingSmsServiceImpl.java
@Override @Scheduled(cron = "${cron.sending.sms.scheduller}") @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void sendScheduleSms() throws Exception { List<TaskDefinition> allDataHaveToSendBySms = taskDefinitionDao.getAllData(); for (TaskDefinition taskDefinition : allDataHaveToSendBySms) { if (taskDefinition.getScheduleType().equals(SMSGATEWAY.SMS_REPEAT)) { if (SMSGATEWAY.EVERY_DAY.equals(taskDefinition.getIsRepeatOnCondition())) { if (new Date().after(taskDefinition.getDate()) || new Date().equals(taskDefinition.getDate())) { String waktuSekarang = new SimpleDateFormat("HH:mm:ss").format(new Date()); String waktukirim = new SimpleDateFormat("HH:mm:ss").format(taskDefinition.getTime()); if (waktuSekarang.equals(waktukirim)) { sendingSms(taskDefinition); }//from w w w. jav a 2 s. c o m } } if (SMSGATEWAY.EVERY_WEEK.equals(taskDefinition.getIsRepeatOnCondition())) { if (new Date().after(taskDefinition.getDate()) || new Date().equals(taskDefinition.getDate())) { String hariSekarang = new SimpleDateFormat("EEEE").format(new Date()); System.out.println(" hari sekarngan ad" + hariSekarang); String hariPengiriman = new SimpleDateFormat("EEEE").format(taskDefinition.getDate()); System.out.println(" hari pengirimana ad" + hariPengiriman); if (hariSekarang.equals(hariPengiriman)) { String waktuSekarang = new SimpleDateFormat("HH:mm:ss").format(new Date()); String waktukirim = new SimpleDateFormat("HH:mm:ss").format(taskDefinition.getTime()); if (waktuSekarang.equals(waktukirim)) { sendingSms(taskDefinition); } } } } if (SMSGATEWAY.EVERY_MONTH.equals(taskDefinition.getIsRepeatOnCondition())) { if (new Date().after(taskDefinition.getDate()) || new Date().equals(taskDefinition.getDate())) { String tanggalSekarng = new SimpleDateFormat("dd").format(new Date()); String tanggalPengiriman = new SimpleDateFormat("dd").format(taskDefinition.getDate()); if (tanggalSekarng.equals(tanggalPengiriman)) { String waktuSekarang = new SimpleDateFormat("HH:mm:ss").format(new Date()); String waktukirim = new SimpleDateFormat("HH:mm:ss").format(taskDefinition.getTime()); if (waktuSekarang.equals(waktukirim)) { sendingSms(taskDefinition); } } } } } if (SMSGATEWAY.SMS_ONCE.equals(taskDefinition.getScheduleType())) { if (new Date().equals(taskDefinition.getDate())) { String waktuSekarang = new SimpleDateFormat("HH:mm:ss").format(new Date()); String waktukirim = new SimpleDateFormat("HH:mm:ss").format(taskDefinition.getTime()); if (waktuSekarang.equals(waktukirim)) { sendingSms(taskDefinition); } } } } }
From source file:com.thesoftwareguild.addressbook.dao.AddressBookDaoDbImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public Address addAddress(Address address) { jdbcTemplate.update(SQL_INSERT_ADDRESS, address.getFirst(), address.getLast(), address.getStreet(), address.getCity(), address.getState(), address.getZip()); address.setAddressId(jdbcTemplate.queryForObject("select LAST_INSERT_ID()", Integer.class)); return address; }
From source file:com.mycompany.capstone.dao.CategoryDaoDbImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED) public void update(Category category) { jdbcTemplate.update(SQL_UPDATE_CATEGORY, category.getCategory(), category.getId()); }
From source file:com.swcguild.addressbookwebapp.dao.AddressBookDAODbImpl.java
@Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false) public Address addAddress(Address address) { jdbcTemplate.update(SQL_INSERT_ADDRESS, address.getFirstName(), address.getLastName(), address.getStreetAddress(), address.getCity(), address.getState(), address.getZip()); address.setAddressId(jdbcTemplate.queryForObject("select LAST_INSERT_ID()", Integer.class)); return address; }
From source file:net.solarnetwork.node.reactor.simple.SimpleReactorService.java
@Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public InstructionStatus processInstruction(Instruction instruction) { // look for an existing status... Instruction instr = instructionDao.getInstruction(instruction.getRemoteInstructionId(), instruction.getInstructorId()); if (instr == null) { // persist new status instr = instructionDao.getInstruction(instructionDao.storeInstruction(instruction)); }//w w w . j a v a 2s . c o m return instr.getStatus(); }
From source file:uk.ac.ebi.intact.editor.services.curate.participant.ParticipantEditorService.java
@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED) public int countAnnotations(AbstractIntactParticipant participant) { return getIntactDao().getParticipantDao(participant.getClass()) .countAnnotationsForParticipant(participant.getAc()); }
From source file:uk.ac.ebi.intact.editor.services.admin.report.AssignmentReportService.java
@Transactional(value = "jamiTransactionManager", propagation = Propagation.REQUIRED, readOnly = true) public List<AssignmentInfo> calculatePublicationReviewerAssignments(Date fromDate, Date toDate) { List<AssignmentInfo> assignmentInfos = new ArrayList<AssignmentInfo>(); Query query = getIntactDao().getEntityManager() .createQuery("select distinct p from IntactPublication p join p.lifecycleEvents as e where " + "e.cvEvent.shortName = :cvEvent and e.when >= :dateFrom and e.when <= :dateTo and e.note is null"); query.setParameter("cvEvent", LifeCycleEventType.READY_FOR_CHECKING.shortLabel()); query.setParameter("dateFrom", fromDate); query.setParameter("dateTo", new DateTime(toDate).plusDays(1).minusSeconds(1).toDate()); List<IntactPublication> pubs = query.getResultList(); Multiset<String> multiset = HashMultiset.create(); for (IntactPublication pub : pubs) { for (LifeCycleEvent event : pub.getLifecycleEvents()) { multiset.add(pub.getCurrentReviewer().getLogin()); }//from www . jav a 2 s . c om } int total = multiset.size(); for (String reviewer : multiset.elementSet()) { int count = multiset.count(reviewer); int percentage = count * 100 / total; assignmentInfos.add(new AssignmentInfo(reviewer, count, percentage)); } return assignmentInfos; }