• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Questions about tx in Spring

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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)
 
Don't play dumb with me! But you can try this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic