ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Slate <jsl...@mtl.mit.edu>
Subject Re: passing in java date
Date Thu, 21 Aug 2008 14:10:51 GMT
Okay, so you mean and AOP proxy, right? Thanks for the suggestion. It 
doesn't seem like that's documented much, looking at the mailing list 
archives I'm guessing my best bet would be to download the iBATIS source 
and see how you guys are doing the logging stuff, right?

I don't know, I'm guessing this is going to be more work than it is 
worth for me in the long run. But if there are some decent examples 
maybe I'll give it a try, or would it be helpful if I did it and wrote 
it up for others? Not sure if this is something other people would need.

If I *did* do this, would it make more sense to pass in the date as part 
of the parameterObject or as a property? It looks like the properties 
(java.util.Properties) get passed to the SqlMapClientBuilder which 
builds the SqlMapClient, so I'm thinking that once the SqlMapClient is 
built, those properties are essentially unmodifiable.

Or I could do before advice for all the methods that take a 
parameterObject to create a map, setting a "currentTime" value and... 
hm... "parameterObject" value? ...well, I think I'd have some things to 
work out there.

Maybe I'm missing something obvious here. :)

Thanks again,
Jonathan





Larry Meadors wrote:
> Put a proxy on the sql map client interface.
>
> Larry
>
>
> On Thu, Aug 21, 2008 at 6:57 AM, Jonathan Slate <jslate@mtl.mit.edu> wrote:
>   
>> Hi:
>>
>> We were having some problems where the time on the Web server and the DB
>> server are off by a few milliseconds and it was causing some issues, so
>> rather than rely on getting the times synched perfectly, I thought we could
>> just always use the time on the Web server by passing in the current time
>> when querying.
>>
>> I could change all of our "getSqlMapClientTemplate()..." calls to pass in a
>> map that includes the current java date/time, but that would be a lot of
>> work (and I'm lazy). So I was trying to find a way to always make "now"
>> available  to my SQL maps.
>>
>> For example:
>> SELECT * FROM foo WHERE start_time <= ${now}
>>
>> I know I can use static properties from a properties file like this. Is
>> there a way to do this for something more dynamic like "current time?"
>>
>> Thanks,
>> Jonathan
>>
>>     

Mime
View raw message