خرید بک لینک

Vote count: 0

I am trying use mybatis-cdi within Wilfly and I need to run part of method in separate transaction - see following snippet:

@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class ItemService {

    @Inject
    @Mapper
    ItemMapper mapper;

    @TransactionAttribute(TransactionAttributeType.REQUIRED)
        public void doSomething() {
            List<Item> items = mapper.findByTime(new Date());
            for(Item i : items) {
                update(i);
        }
    }

    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
        public void update(Item item) {
        mapper.updateSomehow(item);
    }

}

Is this correct way how to do it? Is this supported with mybatis-cdi, or should it be done some different way?

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 25 ارديبهشت 1395 ساعت: 4:53

صفحه بندی