You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ashok Madhavan <as...@gmail.com> on 2007/05/06 03:18:51 UTC

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