ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ou, Stan \(Mission Systems\)" <STAN...@ngc.com>
Subject Date format conversion to/from db
Date Wed, 11 Oct 2006 17:17:41 GMT
Hi all,

I've an application that integrates Spring and iBatis with an Oracle
backend.  We were using Oracle's bc4j before we made the switch.  Since
our dates are persisted to the db in a different format from what we
display on the jsp, what would be the best approach to do the
conversion?  The most straightforward way I think is use a util class to
do the conversion in the getter/setter of the pojo but I'll have to make
the pojo's setter smart enough to know whether I'm reading from the db
or being bound to a form by Spring, something along this line:

If reading from db for display on jsp
  convert from db to gui format

If being bound to Spring form and then persisted to db
  convert from gui to db format

The same goes for the getter.

Our pojos are auto generated, so any logic added will get wiped out if
someone regenerates the pojo.  
Can anyone shed some lights on this?  Any suggestions are welcomed.


View raw message