Thanks Niels this is exactly what I needed.

-----Original Message-----
From: Niels Beekman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 20, 2008 3:54 PM
To: [email protected]
Subject: RE: setting table prefix in sql statement

See
http://www.mail-archive.com/[email protected]/msg09859.html

Niels

-----Original Message-----
From: Artin Petrossian [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 20, 2008 9:39 PM
To: [email protected]
Subject: setting table prefix in sql statement

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



Reply via email to