Java Code Examples for org.springframework.transaction.annotation.Propagation#NOT_SUPPORTED

The following examples show how to use org.springframework.transaction.annotation.Propagation#NOT_SUPPORTED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Message01ServiceImpl.java    From pmq with Apache License 2.0 5 votes vote down vote up
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.NOT_SUPPORTED)
public List<Message01Entity> getMessageByIds(String tbName, List<Long> ids) {
	setMaster(false);
	List<Message01Entity> message01Entitys = null;
	try {
		message01Entitys = message01Repository.getMessageByIds(getDbName() + "." + tbName, ids);
	} catch (Exception e) {
		otherFailCounter.inc();
		throw new RuntimeException(e);
	} finally {
		clearDbId();
	}
	return message01Entitys;
}
 
Example 2
Source File: NotificationMessagePublishingServiceImpl.java    From herd with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 * <p/>
 * This implementation executes non-transactionally, suspends the current transaction if one exists.
 */
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void publishNotificationMessage(NotificationMessage notificationMessage)
{
    publishNotificationMessageImpl(notificationMessage);
}
 
Example 3
Source File: RelationalTableRegistrationServiceImpl.java    From herd with Apache License 2.0 5 votes vote down vote up
@PublishNotificationMessages
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public BusinessObjectData processRelationalTableRegistrationForSchemaUpdate(BusinessObjectDataStorageUnitKey storageUnitKey)
{
    return processRelationalTableRegistrationForSchemaUpdateImpl(storageUnitKey);
}
 
Example 4
Source File: ContainerManagedEntityManagerIntegrationTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void testExceptionTranslationWithDialectFoundOnEntityManagerFactoryBean() throws Exception {
	AbstractEntityManagerFactoryBean aefb =
			(AbstractEntityManagerFactoryBean) applicationContext.getBean("&entityManagerFactory");
	assertNotNull("Dialect must have been set", aefb.getJpaDialect());
	doTestExceptionTranslationWithDialectFound(aefb);
}
 
Example 5
Source File: AnswerServiceBean.java    From bbs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 根据答案Id查询答案在表的第几行
 * @param answerId 答案Id
 * @param questionId 问题Id
 * @return
 */
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
public Long findRowByAnswerId(Long answerId,Long questionId){
	Query query = em.createQuery("select count(o.id) from Answer o where o.id <=?1 and o.questionId= ?2 order by o.postTime asc");
	//给SQL语句设置参数
	query.setParameter(1, answerId);
	query.setParameter(2, questionId);
	return (Long)query.getSingleResult();		
}
 
Example 6
Source File: SimpleAccessTokenService.java    From hsweb-framework with Apache License 2.0 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Cacheable(cacheNames = "oauth2-access-token", key = "'token:'+#accessToken")
public OAuth2AccessToken getTokenByAccessToken(String accessToken) {
    Assert.notNull(accessToken, "accessToken can not be null!");
    return DefaultDSLQueryService.createQuery(oAuth2AccessDao)
            .where("accessToken", accessToken).single();
}
 
Example 7
Source File: AnswerServiceBean.java    From bbs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 根据答案回复Id查询答案回复
 * @param answerReplyId 答案回复Id
 * @return
 */
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
public AnswerReply findReplyByReplyId(Long answerReplyId){
	Query query = em.createQuery("select o from AnswerReply o where o.id =?1");
	//给SQL语句设置参数
	query.setParameter(1, answerReplyId);
	
	List<AnswerReply> replyList = query.getResultList();
	if(replyList != null && replyList.size() >0){
		for(AnswerReply reply : replyList){
			return reply;
		}
	}
	return null;
}
 
Example 8
Source File: EmrHelperServiceImpl.java    From herd with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 * <p/>
 * This implementation executes non-transactionally, suspends the current transaction if one exists.
 */
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public EmrClusterCreateDto emrCreateClusterAwsSpecificSteps(EmrClusterCreateRequest request, EmrClusterDefinition emrClusterDefinition,
    EmrClusterAlternateKeyDto emrClusterAlternateKeyDto)
{
    return emrCreateClusterAwsSpecificStepsImpl(request, emrClusterDefinition, emrClusterAlternateKeyDto);
}
 
Example 9
Source File: ACLServiceBean.java    From bbs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 根据资源表Id查询权限
 * @param resourcesId 资源表Id
 * @return
 */
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
public List<SysPermission> findPermissionByResourcesId(String resourcesId){
	Query query = em.createQuery("select b from SysPermissionResources a," +
		"SysPermission b where a.permissionId = b.id and " +
		"a.resourceId = ?1");
	query.setParameter(1, resourcesId);	
	return query.getResultList();
}
 
Example 10
Source File: BusinessObjectDataServiceImpl.java    From herd with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 * <p/>
 * This implementation executes non-transactionally, suspends the current transaction if one exists.
 */
@NamespacePermission(fields = "#businessObjectDataKey.namespace", permissions = NamespacePermissionEnum.WRITE)
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public BusinessObjectData destroyBusinessObjectData(BusinessObjectDataKey businessObjectDataKey)
{
    return destroyBusinessObjectDataImpl(businessObjectDataKey);
}
 
Example 11
Source File: DepartmentManagerService.java    From OpenCue with Apache License 2.0 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void enableTiManaged(PointInterface p, String tiTask, int cores) {
    pointDao.updateEnableManaged(p, tiTask, cores);
    updateManagedTasks(p);
}
 
Example 12
Source File: ThumbnailServiceBean.java    From bbs with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * 查询所有缩略图
 * @return
 */
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
public List<Thumbnail> findAllThumbnail(){
	Query query =  em.createQuery("select o from Thumbnail o ");
	return query.getResultList();
}
 
Example 13
Source File: ProgrammaticTxMgmtTestNGTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test(expectedExceptions = IllegalStateException.class)
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void endTxWithNonExistentTransactionContext() {
	TestTransaction.end();
}
 
Example 14
Source File: User1ServiceImpl.java    From transaction-test with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void addNotSupported(User1 user){
	user1Mapper.insert(user);
}
 
Example 15
Source File: ProgrammaticTxMgmtTestNGTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test(expectedExceptions = IllegalStateException.class)
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void endTxWithNonExistentTransactionContext() {
	TestTransaction.end();
}
 
Example 16
Source File: TransactionUtilImpl.java    From training with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void executeInNewTransaction(Runnable runnable) {
	runnable.run();
}
 
Example 17
Source File: TemplateServiceBean.java    From bbs with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * 查询系统当前使用的模板目录(目录为空时返回default) - 缓存
 * @return
 */
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
@Cacheable(value="templateServiceBean_cache",key="'findTemplateDir_default'")
public String findTemplateDir_cache(){
	return this.findTemplateDir();
}
 
Example 18
Source File: UserServiceImpl.java    From MultimediaDesktop with Apache License 2.0 4 votes vote down vote up
@Override
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public CommonResponseDto findPassword(String email) {

	CommonResponseDto responseDto = isValidEmail(email);

	try {

		if (UserConstant.EMAIL_INVALID != responseDto.getResult()) {
			if (UserConstant.SUCCESS == responseDto.getResult()) {
				responseDto.setErrorMessage("邮箱未注册");
			}
			throw new VerificationException(responseDto.getErrorMessage());
		}

		User user = userRepository.findByEmail(email);

		if (user == null) {
			throw new VerificationException("用户不存在");
		}

		if (user.isDisable() || !user.isvStatus()) {
			throw new VerificationException("用户被禁用或者邮箱未验证");
		}

		UserMailHandler mailHandler = handler
				.getHandler(EmailConstant.EMAIL_USER_FIND_PASSWORD);

		MailMessage mailMessage = mailHandler.handlerMailMessage(email,
				user);

		CommonResponseDto mailResponseDto = mailService
				.sendValidEmail(mailMessage);

		if (UserConstant.SUCCESS == mailResponseDto.getResult()) {
			responseDto.setResult(UserConstant.SUCCESS);
		} else {
			return mailResponseDto;
		}

	} catch (VerificationException e) {
		responseDto.setResult(UserConstant.ERROR);
		responseDto.setErrorMessage(e.getMessage());
	}

	return responseDto;
}
 
Example 19
Source File: QuestionServiceBean.java    From bbs with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * 分页查询问题
 * @param firstIndex 开始索引
 * @param maxResult 需要获取的记录数
 * @return
 */
@Transactional(readOnly=true,propagation=Propagation.NOT_SUPPORTED)
public List<Question> findQuestionByPage(int firstIndex, int maxResult){
	List<Question> questionList = new ArrayList<Question>();
	
	String sql = "select o.id,o.title,o.content,o.appendContent," +
			"o.postTime,o.userName,o.isStaff,o.status " +
			" from Question o ";

	Query query = em.createQuery(sql);	
	
	//索引开始,即从哪条记录开始
	query.setFirstResult(firstIndex);
	//获取多少条数据
	query.setMaxResults(maxResult);
		
	List<Object[]> objectList = query.getResultList();
	if(objectList != null && objectList.size() >0){
		for(int i = 0; i<objectList.size(); i++){
			Object[] obj = (Object[])objectList.get(i);
			Long id = (Long)obj[0];
			String title = (String)obj[1];
			String content = (String)obj[2];
			String appendContent = (String)obj[3];
			Date postTime = (Date)obj[4];
			String userName = (String)obj[5];
			Boolean isStaff = (Boolean)obj[6];
			Integer status = (Integer)obj[7];

			Question question = new Question();
			question.setId(id);
			question.setTitle(title);
			question.setContent(content);
			question.setAppendContent(appendContent);
			question.setPostTime(postTime);
			question.setUserName(userName);
			question.setIsStaff(isStaff);
			question.setStatus(status);
			questionList.add(question);
			
		}
	}
	return questionList;
}
 
Example 20
Source File: R2dbcBookRepository.java    From spring-data-dev-tools with Apache License 2.0 4 votes vote down vote up
@Transactional(propagation = Propagation.NOT_SUPPORTED)
Flux<Book> findAll();