ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Trenner <ole.tren...@googlemail.com>
Subject Re: how tp pass schema name in a query
Date Fri, 12 Oct 2007 18:24:12 GMT
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
file:

<properties resource="sqlmapconfig.properties" />


sqlmapconfig.properties looks like this:

schema1=foo
schema2=bar


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

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


Cheers,
Ole.

Mime
View raw message