ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hemant.Kamatgi <Hemant.Kama...@target.com>
Subject RE: how tp pass schema name in a query
Date Fri, 12 Oct 2007 20:11:10 GMT
Thanks indeed!

-----Original Message-----
From: Ole Trenner [mailto:ole.trenner@googlemail.com]
Sent: Friday, October 12, 2007 1:24 PM
To: user-java@ibatis.apache.org
Subject: Re: how tp pass schema name in a query

Hemant.Kamatgi wrote:
> Is there a way
> where I can pass the schema name from out side as a parameter so that we
> can maintain only one map file I mean, say for a query ,  'select * from
> <schema>.employee' where <schema> is a place holder for a value that can
> be configured.

In fact there is. In your sqlmap-config.xml you can define a properties

<properties resource="sqlmapconfig.properties" />

sqlmapconfig.properties looks like this:


Then you can use named properties everywhere in your sql mappings:

<select id="sampleSelect" parameterClass="..." resultClass="...">
    select * from ${schema1}.tablename


View raw message