ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artin Petrossian <Artin.Petross...@sas.com>
Subject setting table prefix in sql statement
Date Tue, 20 May 2008 19:38:41 GMT
Hi,

Is there a way to define a prefix for a table name in the sqlmap?  For example, let's say
we have a simple select that uses a parameter:

<select id="findById" resultMap="projectLinkResult" parameterClass="java.lang.Long">
   SELECT projectId, customerName
   FROM projects
   WHERE projectId = #value#
</select>

Can I have a prefix value in front of "projects", so it would be something like:

<select id="findById" resultMap="projectLinkResult" parameterClass="java.lang.Long">
   SELECT projectId, customerName
   FROM $prefix$projects
   WHERE projectId = #value#
</select>

...and have that "prefix" value be defined in a property file or anywhere else?

I can't do this using parameter maps because this prefix needs to be applied globally to every
table in all of my sqlmaps, and I only want to define it in one location.  I don't want to
have to go and change all of my parameters to be maps that include both the original param
value as well as this prefix value.

If this is not possible, is it something that will be possible to do in 3.0?

Thanks



Mime
View raw message