Is there some feature that allows a declarative flush as a transactionAttribute similar to PROPAGATE_REQUIRED???
i.e FLUSH_MANDATORY
This way if I call several service methods within on transaction I can declaratively cause a flush to check for successful insert.
i.e:
service1: /* transaction begins */
try {
call service 2
} exception {
check for exception i.e: a db insert failed due to constraint
}
call service 3
/* transaction ends */
in this example
service 1,2 & 3 are proxied by TransactionProxyFactoryBean
and the transaction attributes on 2 cause flush.
In the real example I am trying to implement there is no service 1 and the code is as follows. Service 2 & 3 are transaction proxied normally but because transaction is already started the parent transaction is used:
Code:TransactionStatus transaction = getTransactionManager().getTransaction( new DefaultTransactionDefinition()); call service2 call service 3 getTransactionManager().commit(transaction);


Reply With Quote