ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A Bosetti" <abose...@burrows.co.uk>
Subject ibator best strategy with multiple table formats
Date Thu, 11 Feb 2010 09:58:02 GMT
Hi all

I am new to Ibatis and fairly new with java too so please bear it with me.

I have Eclipse 3.4, Java 1.6.17, Ibatis 2.3.4 and Ibator, all wired up with Spring 2.5.6.

I have an application that has an internal database and that also needs to connect to an external
database.

The external database is provided by the customers and is made up of several tables (about
20) and it comes in two different formats (both formats are on Oracle), one that uses timestamps
and the other one that uses a string representation of datetime. (Oracle 7 didnt have timestamps
apparently)
There are only 3 fields in the whole database that are affected, everything else is exactly
the same.

I have been given this version of the database with timestamps as a mock to test and develop
my application before delivery,(which is the most common), but the application will have to
run transparently on both versions of the database.
Obviously I don't have any control on the customers database but I wish to use Ibatis with
Ibator as I find it very good.

What is a good strategy in this case?

I thought I could for instance treat the two databases as completely indipendent, generate
two different versions of the ibator artifacts and inject the correct one to activate using
spring, but it's a bit overkill to have to generate 20 different maps, 20 daos, 20 object
models just because of 3 fields.

Then I thought it's better to modify the ibatismaps and inside the single generated map, have
two versions of every statement that is affected by these fields (different inserts, selects
etc), but is not very nice either, because then I need to manually modify the daos to call
to correct statements.

Can you point me in the right direction? What is the most maintanable and elegant way to achieve
this?

Thank you in advance 

Alessandro




Mime
View raw message