ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rajaram_Viswanathan" <Rajaram_Viswanat...@Satyam.com>
Subject RE: A separate transaction for the logger
Date Fri, 05 May 2006 05:05:26 GMT
Hello RS,
If you are using Oracle SP to do the logging stuff,the seperate transaction could be achieved
by defining that Logging Store procedure as 
PRAGMA AUTONOMOUS TRANSACTION;
This would suspend the main transaction and would only commit the statements within it.
 
http://www.stanford.edu/dept/itss/docs/oracle/9i/appdev.920/a96590/adg08sql.htm#8280
 
 

________________________________

From: Christopher.Mathrusse@sybase.com [mailto:Christopher.Mathrusse@sybase.com]
Sent: Fri 5/5/2006 5:11 AM
To: user-java@ibatis.apache.org
Subject: RE: A separate transaction for the logger


If you were to use the Spring Framework you could write a new Dao, LoggingDao, to handle inserts
of your logging statements and define that the LoggingDao gets a new transaction as opposed
to participating within the current transaction. This would suspend any current transaction
and begin a new Transaction that would operate outside of your existing transaction and would
cause your logging inserts to always commit, but you would need to decide if this were to
occur before or after the execution of your other database activities. 
 
If you want to get really fancy and clean, you would write an interceptor (Before Advice)
that would perform the insert, using LoggingDao, before the other statements get executed.
That way there is no need to place this logging mechanism within your code at all. (Separation
of concerns)

________________________________

From: "rs"<rustystone@myway.com> [mailto:"rs"<rustystone@myway.com>] 
Sent: Thursday, May 04, 2006 4:08 PM
To: user-java@ibatis.apache.org
Subject: A separate transaction for the logger



Hi, 

Am using a single static instance of SqlMapClient for all my DAOs. There's a need to save
some logging info into the database regardless if the application logic fails or not, i.e.
there is a need to start a separte transaction for logger. 

Illustration: 

// application logic 
... 
SQL_MAPPER.startTransaction(); 
// do some stuff 
... 
//-----------> log current app status 
// 
// 1) start a new transaction for logger 
// 2) log the status 
// 3) commit and end logger transaction 
... 
// application error here but the status has been saved and committed 
... 
SQL_MAPPER.endTransaction(); 


So the question is how to start a new separate transaton for the logger. I'm thinking about
building a separate instance of SqlMapClient just for logger operations but maybe there's
a better way. 

Thanks 









_______________________________________________ 
No banners. No pop-ups. No kidding. 
Make My Way your home on the Web - http://www.myway.com 






DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s
and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review
or reliance by others or copying or distribution or forwarding of any or all of the contents
in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard is appreciated.

Mime
View raw message