ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lamey <cla...@localmatters.com>
Subject RE: Taking care of different databases
Date Mon, 07 May 2007 15:16:54 GMT
FYI, you can have a single sqlmap hit multiple datasources.  Search the
mailing list archive for AbstractRoutingDataSource and
RoutableSqlMapClient.

On Mon, 2007-05-07 at 08:41 +0200, Niels Beekman wrote:
> As for selectKey statements, see
> http://issues.apache.org/jira/browse/IBATIS-142 for a hint on this.
> Otherwise, I think you need to include different sqlmaps for different
> databases, search the archives for some examples.
> 
>  
> 
> Niels
> 
>  
> 
>                                    
> ______________________________________________________________________
> From: Ashok Madhavan [mailto:ashok.madhavan@gmail.com] 
> Sent: zondag 6 mei 2007 3:19
> To: user-java@ibatis.apache.org
> Subject: Taking care of different databases
> 
> 
>  
> 
> Hi all,
> 
> Our product can be deployed in different app servers and different
> databases. Presently we have a existing inhouse DB library which takes
> care of this. it takes care of inserts in different databases
> properly. it basically checks for the type of database and gets the id
> of the just inserted record accordingly. 
> 
> I understand in iBatis i can do this but for a given type of database
> at a given time. if i need to use the same xml for inserting records
> across databases, how do i do it ? i can use Abator to generate xml
> but it assumes i use only one type of database. 
> 
> like for postgres
>     <insert id="insertColorSize"
> parameterClass="com.xxx.ProductColorSize" >
>         insert into tb_products_color_sizechart ( company_id,
> product_uid, product_number, color_code_uid, size_chart_uid,
>         image_url, carryover, sku, upc, description, top_seller )
>         values
>         ( #companyId:NUMERIC#, #productUID:NUMERIC#,
> #productNumber:VARCHAR#, #colorCodeUID:NUMERIC#,
> #sizeChartUID:NUMERIC#, #imageUrl:VARCHAR#, 
>         #carryOver:VARCHAR#, #sku:VARCHAR#, #upc:VARCHAR#,
> #description:VARCHAR#, #topSeller:VARCHAR#  )
>         <selectKey keyProperty="productColorSizeChartUID"
> resultClass="long">
>             select
> currval('tb_products_color_sizechart_product_color_size_chart_uid_seq')
>         </selectKey>
>     </insert>
> 
> can ibatis automatically take care of this ?
> 
> any pointers, advice, suggestions would be welcome.
> 
> regards
> Ashok 
> 
> 

Mime
View raw message