java类org.springframework.transaction.annotation.Transactional的实例源码

QuestionBankManagerImpl.java 文件源码 项目:DWSurvey 阅读 26 收藏 0 点赞 0 评论 0
@Override
@Transactional
public void delete(String id) {
    //设为不可见
    QuestionBank questionBank=get(id);
    questionBank.setVisibility(0);
    questionBankDao.save(questionBank);
    Criterion criterion=Restrictions.eq("parentId", questionBank.getId());
    List<QuestionBank> banks=findList(criterion);
    if(banks!=null){
        for (QuestionBank questionBank2 : banks) {
            delete(questionBank2);
        }
    }
}
SubCategoryResourceIntTest.java 文件源码 项目:spring-io 阅读 20 收藏 0 点赞 0 评论 0
@Test
@Transactional
public void searchSubCategory() throws Exception {
    // Initialize the database
    subCategoryService.save(subCategory);

    // Search the subCategory
    restSubCategoryMockMvc.perform(get("/api/_search/sub-categories?query=id:" + subCategory.getId()))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
        .andExpect(jsonPath("$.[*].id").value(hasItem(subCategory.getId().intValue())))
        .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())));
}
SourceDaoImpl.java 文件源码 项目:graphium 阅读 26 收藏 0 点赞 0 评论 0
@Override
@Transactional(readOnly=false)
public void save(ISource source) {
    Map<String, Object>  params = new HashMap<String, Object>(); 
    params.put("sourceName", source.getName());
    MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(params);
    KeyHolder keyHolder = new GeneratedKeyHolder();

    getNamedParameterJdbcTemplate().update("INSERT INTO " + schema + "sources (name) VALUES (:sourceName)", 
            sqlParameterSource, keyHolder, new String[] {"id"});

    int id = Integer.class.cast(keyHolder.getKey());
    source.setId(id);
}
JpaEventDao.java 文件源码 项目:Spring-Security-Third-Edition 阅读 32 收藏 0 点赞 0 评论 0
@Override
@Transactional(readOnly = true)
public List<Event> findForUser(final String email) {
    Event example = new Event();
    CalendarUser cu = new CalendarUser();
    cu.setEmail(email);
    example.setOwner(cu);

    return repository.findAll(Example.of(example));
}
TagResourceIntTest.java 文件源码 项目:devoxxus-jhipster-microservices-demo 阅读 25 收藏 0 点赞 0 评论 0
@Test
@Transactional
public void getNonExistingTag() throws Exception {
    // Get the tag
    restTagMockMvc.perform(get("/api/tags/{id}", Long.MAX_VALUE))
        .andExpect(status().isNotFound());
}
ItemServiceImpl.java 文件源码 项目:Equella 阅读 27 收藏 0 点赞 0 评论 0
@Override
@Transactional(propagation = Propagation.NEVER)
public void itemOperationEvent(ItemOperationEvent event)
{
    try
    {
        operateAll(event.getOperation(), null);
    }
    catch( WorkflowException ex )
    {
        logger.error(CurrentLocale.get("com.tle.core.services.item.error.operation"), ex);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号