spring-transactions

Is Transactional possible extend to other operations more than to db in Spring?

筅森魡賤 提交于 2021-01-27 19:21:38
问题 I explain the context: I implemented the export and import records from two differents Data base in other words a refresh of seven tables. I used JdbcCursorItemReader to perform the select chunked queries because there are over 600000 records for each table and save every chunk with jdbc batch insert on the other DB. The implented idea has been the followed: REMARK on requirement : All tables must be refreshed in unique transaction, if only a chunk of any table fails rollback I have created a

Is Transactional possible extend to other operations more than to db in Spring?

烂漫一生 提交于 2021-01-27 18:29:20
问题 I explain the context: I implemented the export and import records from two differents Data base in other words a refresh of seven tables. I used JdbcCursorItemReader to perform the select chunked queries because there are over 600000 records for each table and save every chunk with jdbc batch insert on the other DB. The implented idea has been the followed: REMARK on requirement : All tables must be refreshed in unique transaction, if only a chunk of any table fails rollback I have created a

Does Spring actually start a new transaction with REQUIRES_NEW?

人盡茶涼 提交于 2020-12-29 12:36:21
问题 My spring (4.1.1) application is deployed on a JBoss-6.10-final instance, so it uses the container-based transaction manager and data sources. For messaging, I use TIBCO EMS 8.1 with an XA queue connection factory set up. The Java version is 1.8.0_20. All of this is running on my Ubuntu 14.04 laptop. I need to send a request via JMS and then wait for the reply. The bean I’m calling from has transaction propagation set to Propagation.REQUIRED, so I need to send the request in a new transaction

Changes made in a @Transactional method are not reflected to the Entity

懵懂的女人 提交于 2020-08-26 08:33:49
问题 I have the following method in my Service Layer, which Retrieves an entity by ID Executes an update to the entity Retrieves and returns the same entity @Transactional @Override public Order acceptOrder(long orderId){ Order Order = getOrderById(orderId); // 1 orderDao.updateOrderStatus(OrderStatus.PENDING_COMPLETION, orderId); // 2 return getOrderById(orderId); // 3 } The service's method getOrderById @Override public Order getOrderById(long id) { return orderDao.get(Order.class, id); } And

Transactional annotation to rollback for every checked exception - with AspectJ

吃可爱长大的小学妹 提交于 2020-08-09 18:28:53
问题 I would like to use @Transactional annotation ( org.springframework.transaction.annotation ) for transactions management. I need the rollback to occur for every exception (not just unchecked exceptions), so I use: @Transactional (rollbackFor = Exception.class) I use AspectJ mode, and it's working fine. The problem is, I don't want the developer to have to add the rollbackFor attribute every time. I found this answer, that suggests to extend the @Transactional annotation, like so: @Target(