Results 1 to 3 of 3

Thread: NameMatchTransactionAttributeSource.isMatch(...)

  1. #1
    Join Date
    Aug 2004
    Location
    Germany, Magdeburg
    Posts
    279

    Default NameMatchTransactionAttributeSource.isMatch(...)

    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:

    Code:
    <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]

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    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,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3
    Join Date
    Aug 2004
    Location
    Germany, Magdeburg
    Posts
    279

    Default

    :shock: Ummm, ähhh,... Aha!

    Well I see, this one does the trick:

    Code:
    TransactionAttribute attr = &#40;TransactionAttribute&#41; this.nameMap.get&#40;methodName&#41;;
    		if &#40;attr != null&#41; &#123;
    			return attr;
    		&#125;
    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:

    Code:
    else &#123;
    			// look up most specific name match
    			String bestNameMatch = null;
    &#91;...&#93;
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •