• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Questions about tx in Spring

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I have some questions about Transaction management in Spring.
Consider the followig lines from Spring's docs:

1. Can I specify another targets or each intercepter requires only one target ?
2. What do <prop key="insert*"><prop key="update*"><prop key="*"> mean ?
Thanks.
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
insert* and the rest are just naming patterns like Unix shell globbing. A pattern of "*" is more general, "insert*" is more specific. Most specific match should take effect, I believe.

Not sure of the easiest way to deal with multiple targets, but you can cut down on the boilerplate by extending a bean definition (parent=... instead of class=...). There is a more powerful idiom involving pointcuts and autoproxy, but I haven't mucked around with it.
 
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interceptors are meant to be stateless and can be used with multiple targets.
 
Ken Krebs
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I should clarify, TransactionInterceptor is threadsafe. Some other interceptors may not be.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Each interceptor supports only one target when using TransactionProxyFactoryBean. You can check out BeanNameAutoProxyCreator to support multiple targets (thereby avoiding having to put in a 5 line xml fragment for each target)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic