|
From: Kopylenko, D. <dko...@ac...> - 2003-10-16 19:48:51
|
Petra,
> In my case I have now business/management object which make use of =
more
than only one DAO (is this ok?)
That is perfectly ok.
>Can I somehow get control of the actual transaction functionality? =
What
possiblities do I have? Are rollbacks automatically performed if=20
>something goes wrong?
In general, if the Exception is thrown by the DAO (usually unchecked) =
and is
caught by Tx interceptor, then the transaction is rolled back =
automatically.
But you could declaratively specify the Exceptions for which you want =
to
rollback and for which you want to commit if caught by Tx AOP e.g.
<bean id=3D"exampleTransactionInterceptor"
class=3D"org.springframework.transaction.interceptor.TransactionIntercep=
tor">
<property name=3D"transactionManager"><ref
bean=3D"myTransactionManager"/></property>
<property name=3D"transactionAttributeSource">
<value>
=09
example.ExampleBusinessInterface.exampleMethod=3DPROPAGATION_REQUIRED,co=
m.myco
mpany.MyException1+,com.mycompany.MyException2-
=09
example.ExampleBusinessInterface.anotherExampleMethod=3DPROPAGATION_REQU=
IRED
</value>
</property>
</bean>
So the (+) in the declaration: "com.mycompany.MyException1+" directs Tx =
AOP
infrastructure to commit the transaction if this exception is caught =
and
respectively (-): com.mycompany.MyException1- says roll it back.
Hope this helps,
Dmitriy.=20
-----Original Message-----
From: petra staub [mailto:ca...@ho...]=20
Sent: Thursday, October 16, 2003 3:21 PM
To: spr...@li...
Subject: [Springframework-developer] Transactions / AOP / Hibernate
Hi
I have a question to the transaction handling with Springframework, in
details, applying Declarative Transaction Demarcation (as outlined in =
the
"Data Access with the Spring Framework" on Hibernates site).
In advance, sorry for my little knowledge on AOP which may be the main
reason for my question here... ;
Well, as I understood, you can declare an "Interceptor" which inserts/
"weaves in" transaction management code into the appropriate class =
methods.
I think this happens when entering and exiting the methods or am I =
wrong?
In my little application, I have (as suggested by Dmitry in an earlier
posting) created DAO objects, which do not know anything about trans-
actions and soley perform "basic" database work, and business objects, =
or
"management beans" which use these DAO objects and provide the final
interface for persisting methods to the user.
In my case I have now business/management object which make use of more =
than
only one DAO (is this ok?). I would like to things like
BusinessObject {
a_Method {
(Transactions start by Interceptor??)
DAO_A.do_something; ---> requires transactions
DAO_B.do_something_else; ---> must not be transaction
oriented
(Transaction commit by Interceptor??)
}
}
Can I somehow get control of the actual transaction functionality? What
possiblities do I have? Are rollbacks automatically performed if =
something
goes wrong?
This AOP stuff does for me some "magic" stuff, I just can't grasp =
somehow...
:-)
Thanks for any Springframework-brush ups! ;-)
_________________________________________________________________
MSN Hotmail=A0 - =A0Absolut kostenfrei! Der weltweit gr=F6sste =
E-Mail-Anbieter im=20
Netz: http://www.msn.ch/hotmail
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. =
SourceForge.net
hosts over 70,000 Open Source Projects. See the people who have HELPED =
US
provide better services: Click here: =
http://sourceforge.net/supporters.php
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|