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 Serafín Orillán Chaparro <se...@isotrol.com> on 2006/07/10 14:49:12 UTC

Table names as parameter

Is there any way to pass the very table names as parameters, to be able 
to do something like this:

<select id="foo" parameterClass="java.util.Map">
    SELECT ID, NAME FROM #tableName#
</select>

?

Thanx!

-- 
Serafín Orillán Chaparro
Isotrol S.A.
Avda. de la Innovación 1, 3ª planta
+34 955 036 800
e-mail: serafin.orillan@isotrol.com



Re: Table names as parameter

Posted by Ted Schrader <ts...@gmail.com>.
Hi Serafin,

Also, when using Torsten's suggestion, be sure to consider if you will
need to remap your results.  The remapResults attribute is explained
here:

http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=3057

Ted

On 10/07/06, Torsten Michelmann <to...@gmx.de> wrote:
> Hi,
>
> have a look at http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+pass+in+a+dynamic+table+name+-+or+other+uncommon+parameters
>
> Basically use $tableName$. This will change the SQL statement before the prepared Statement is created.
>
>
> -------- Original-Nachricht --------
> Datum: Mon, 10 Jul 2006 14:49:12 +0200
> Von: "Serafín Orillán Chaparro" <se...@isotrol.com>
> An: user-java@ibatis.apache.org
> Betreff: Table names as parameter
>
> >
> > Is there any way to pass the very table names as parameters, to be able
> > to do something like this:
> >
> > <select id="foo" parameterClass="java.util.Map">
> >     SELECT ID, NAME FROM #tableName#
> > </select>
> >
> > ?
> >
> > Thanx!
> >
> > --
> > Serafín Orillán Chaparro
> > Isotrol S.A.
> > Avda. de la Innovación 1, 3ª planta
> > +34 955 036 800
> > e-mail: serafin.orillan@isotrol.com
> >
>
> --
> Greetings
> Torsten
>
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
>

Re: Table names as parameter

Posted by Torsten Michelmann <to...@gmx.de>.
Hi,

have a look at http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+pass+in+a+dynamic+table+name+-+or+other+uncommon+parameters

Basically use $tableName$. This will change the SQL statement before the prepared Statement is created.


-------- Original-Nachricht --------
Datum: Mon, 10 Jul 2006 14:49:12 +0200
Von: "Serafín Orillán Chaparro" <se...@isotrol.com>
An: user-java@ibatis.apache.org
Betreff: Table names as parameter

> 
> Is there any way to pass the very table names as parameters, to be able 
> to do something like this:
> 
> <select id="foo" parameterClass="java.util.Map">
>     SELECT ID, NAME FROM #tableName#
> </select>
> 
> ?
> 
> Thanx!
> 
> -- 
> Serafín Orillán Chaparro
> Isotrol S.A.
> Avda. de la Innovación 1, 3ª planta
> +34 955 036 800
> e-mail: serafin.orillan@isotrol.com
> 

-- 
Greetings
Torsten 

Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer