Reputation: 5612
Is there a way to set checkpoints in a spring managed transaction and if something goes wrong, the rollback should happen only till the last checkpoint.
Upvotes: 1
Views: 1727
Reputation: 6283
You can manage check point using SavePointManager in spring. to use this first you have to TransactionTemplate and do programatic transcation management so u can get control over transaction status
and then use SavePointManager methods to create checkpoint.
if you want to this to managed by aspect then it will be very easy to write using customer annotation and aspect over spring beans.
Upvotes: 0
Reputation: 299048
I second Ajinkya's answer. Spring has a Transaction abstraction that is technology-independent and has implementations for many different technologies (Hibernate, JPA, JDBC etc), only some of which have features like the ones you seem to need.
Spring Transactions have been kept simple, so that the persistence layer can be switched to a new technology without changing anything in the service layer. This flexibility comes at the cost of power, because only the most common transactional metaphors will be available on all supported platforms. Learn to live with the limitations and convert your task into several sub tasks.
Upvotes: 0
Reputation: 22720
IMO if we say transaction it must be either all or none.
Doing a rollback till the checkpoint means we are doing a partial transaction.
Still if you want to rollback till some particular point then converting tasks into number of transactions will a good choice. (If you can convert it into multiple transactions)
Upvotes: 2