Affects Version/s: None
Fix Version/s: None
It's just a suggestion, but i really believe it would be a useful improvement:
Apparently, withTransaction supports only propagation "required". This could be enough for regular applications, but it "fails" when you need a fine-grained transaction control.
The suggested improvement is to offer another closure or to change withTransaction definition (HibernatePluginSupport.groovy) to support additional properties. These properties will be used to configure TransactionTemplate instance. I've written something similar in other project:
So we can easily start a new different transaction (even inside a Service class method/closure):
or even something more complex:
It makes more sense to me to change withTransaction implementation than adding another closure because not every propagation type will create a "new transaction".
For a new closure implementation, properties could be initialized as the sample (it's just a suggestion).
For a changing in withTransaction implementation, properties should be initialized as an empty Map (properties = [:]) or null map (with null check), for backward compatibility.