File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Questions about tx in Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Other Application Frameworks
Reply Bookmark "Questions about tx in Spring" Watch "Questions about tx in Spring" New topic
Author

Questions about tx in Spring

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3334

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.
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
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.


Reid - SCJP2 (April 2002)
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
Interceptors are meant to be stateless and can be used with multiple targets.


kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
I should clarify, TransactionInterceptor is threadsafe. Some other interceptors may not be.
Sabarish Sasidharan
Ranch Hand

Joined: Aug 29, 2002
Posts: 73
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)


Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda
 
IntelliJ Java IDE
 
subject: Questions about tx in Spring
 
Threads others viewed
unsatisfied Dependancy exception
Hibernate insert fails due to generate key failure
JDBCContext returning TransactionManager as null
Spring and declarative transactions
Help me understand this piece of code
MyEclipse, The Clear Choice