PDA

View Full Version : NameMatchTransactionAttributeSource.isMatch(...)


Martin Kersten
Aug 13th, 2004, 03:32 AM
Currently the isMatch method only checks for XXX* and *XXX matches. Since this is a way strickt, I ran into an issue related to fully specifying the method name.

So it wasn't that hard to come up with something like this:


<bean...>
...
<property name="transactionAttributes">
<props>
<prop key="myMethod">PROPAGATION_REQUIRED,read_only</prop>
</props>
</property>
</bean>


So I guess the method should for equality, too.


Thanks,

Martin (Kersten)[/code]

Colin Sampaleanu
Aug 13th, 2004, 02:24 PM
Have you tried this :-)

If you look at the code a bit better, you'll see that isMatch is called only _after_ an exact match (equality test) fails.

Regards,

Martin Kersten
Aug 13th, 2004, 03:13 PM
:shock: Ummm, ähhh,... Aha!

Well I see, this one does the trick:

TransactionAttribute attr = (TransactionAttribute) this.nameMap.get(methodName);
if (attr != null) {
return attr;
}


I had a problem half a year ago. I visit the source and though hey no equal match, just add stars. So I changed it and well I guess ... Uhm don't know.

But look at this:

else {
// look up most specific name match
String bestNameMatch = null;
[...]


The code is saying something to me: "Please split me up, I am a method responsible for two things in one..."

Anyways, problem solved! - Thanks!

Martin (Kersten)