ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Kirchheimer <rkirchhei...@infometis.ch>
Subject Re: switch database (different sql code)
Date Wed, 20 Jul 2005 12:42:48 GMT
thank you for your input.

i made it like you said with de common and the specific files.
then i wrote an ant script for copying the files to the right place.

important is that in de specific files, the namespace <sqlMap
namespace="xxxx">
is the same as in the common files, so the result maps have to be
defined only once.

regards
ron

Am Di 19.07.2005 18:17 schrieb Nathan Maves <Nathan.Maves@Sun.COM>:

> 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