You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by an...@axa.com.au on 2005/08/19 06:38:52 UTC

update listener

As part of requirements in our project, we need to verify data before 
update using timestamp algorithm
by comparing retrieved timestamp value and current value in timestamp 
column.

This has to be done before every update statement.

At this point, I'm using a generic DAO which will be extended by all DAOs 
and it has got method to do that.

But for every update statement it needs to be called explicitely. And it 
will be DAO developers responsibility.

Is it possible to add listener with update statement or any other generic 
approach ??

Alliance Bernstein: Winner of Money Management "FUND MANAGER OF THE YEAR 2005" 
Member of the Global AXA Group

*********************************************************************************
Important Note
This email (including any attachments) contains information which is 
confidential and may be subject to legal privilege.  If you are not 
the intended recipient you must not use, distribute or copy this 
email.  If you have received this email in error please notify the 
sender immediately and delete this email. Any views expressed in this 
email are not necessarily the views of AXA.   Thank you.
**********************************************************************************

Re: update listener

Posted by Clinton Begin <cl...@gmail.com>.
Yep. 

If you want to do it at the DAO layer, you could write a dynamic proxy the 
intercepts all of your DAO method calls to perform the check. You could use 
naming conventions to determine whether the check is needed (i.e. all 
updateXxxxxxx() methods).

If you want to do it at the SQL Map layer, you can proxy SqlMapClient (which 
is an interface). You only need to trap the update() method to do the check.

Hope that helps.

Cheers,
Clinton


On 8/18/05, ankur.kumar@axa.com.au <an...@axa.com.au> wrote:
> 
> 
> As part of requirements in our project, we need to verify data before 
> update using timestamp algorithm 
> by comparing retrieved timestamp value and current value in timestamp 
> column. 
> 
> This has to be done before every update statement. 
> 
> At this point, I'm using a generic DAO which will be extended by all DAOs 
> and it has got method to do that. 
> 
> But for every update statement it needs to be called explicitely. And it 
> will be DAO developers responsibility. 
> 
> Is it possible to add listener with update statement or any other generic 
> approach ??
> 
> 
> 
> Alliance Bernstein: Winner of Money Management "FUND MANAGER OF THE YEAR 
> 2005" 
> Member of the Global AXA Group
> 
> 
> *********************************************************************************
> Important Note
> This email (including any attachments) contains information which is 
> confidential and may be subject to legal privilege. If you are not 
> the intended recipient you must not use, distribute or copy this 
> email. If you have received this email in error please notify the 
> sender immediately and delete this email. Any views expressed in this 
> email are not necessarily the views of AXA. Thank you.
> 
> **********************************************************************************