ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <Nathan.Ma...@Sun.COM>
Subject Re: switch database (different sql code)
Date Tue, 19 Jul 2005 16:17:55 GMT
To make it a bit more clear I would name each of the specific db  
files like...

/ibatis/mapping/common.xml
/ibatis/mapping/oracle/specific.xml
/ibatis/mapping/postgres/specific.xml

Then at build time move the one you need into the specific directory  
where the sqlmap config is expecting it.  This way the config file  
never need to be changed.  Just rebuild with a specified option.

so in the end you will always end up with

common.xml
specific.xml

Hope this helps.

Nathan

On Jul 19, 2005, at 10:11 AM, Nathan Maves wrote:

> I would take this one small step further.  I would create a common  
> xml file for all aspect that are well common.  Then I would create  
> different maps for the unique queries.
>
> Nathan
>
> On Jul 19, 2005, at 9:38 AM, Brice Ruth wrote:
>
>> You can include SQL code from a properties file. So, setup one  
>> that has the salient SQL code in it for Oracle, and one for  
>> Postgres, then you don't have to change the XML, just use a  
>> property and make sure that when the app starts, the correct  
>> property file is loaded.
>>
>> Make sense?
>>
>> 2005/7/19, Ron Kirchheimer <rkirchheimer@infometis.ch>:
>> hi all
>>
>> i'm using ibatis sql-maps and dao framework (version 2).
>> my java application should run on an oracle and postgres database.
>> (switchable through a properties file)
>>
>> now the problem is, that i must write different sql code for some
>> statements (not a lot)
>> > to bad that there isn't a real sql standard!
>>
>> so what would be the best way to handle this?
>>
>> i don't want to copy all the sql-map xml files, because most of the
>> sql code will stay as it is.
>>
>> thx for your help
>> ron
>>
>>
>>
>>
>> -- 
>> Brice Ruth
>> Software Engineer, Madison WI
>


Mime
View raw message