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 Scott Zhu <sc...@gmail.com> on 2006/08/30 16:32:13 UTC

remapResults setting and force a reload of sqlmap at runtime

In our application, we need to support dynamic table names, so our statement
would look something like this:

   <select id="getProductIndexByOfferId" *remapResults="true"*parameterClass="
java.util.Map" resultMap="productIndexResult">
      <![CDATA[
      select p.ProductID
      from *$UA_ProductIndex$* p
      where OfferID=#offerID#
      ]]>
   </select>

If I understand it correctly, the remapResults is needed if the selected
columns or table names can be different at statement execution time (in
order to regenerate the prepared statement). In our case though, once we
choose the table name, it will remain the same until we change the
configuration (happens rarely). Since there's a performance hit by using
this setting (remapResults), I wonder if it's possible for us not to set it.
Then when the configuration is changed, is there a way we can force a reload
of (all the) sqlmap statements on the fly (we don't have an option to bounce
the app server)? I guess if not, I can still throw away the sqlclient
instance and re-create it.

Thanks.

Re: remapResults setting and force a reload of sqlmap at runtime

Posted by Larry Meadors <lm...@apache.org>.
(1) Yes and (2) No. :-)

On 8/30/06, Scott Zhu <sc...@gmail.com> wrote:
>
> Thanks for the quick response. So you are saying we don't need the
> remapResults if just the table name is dynamic?
>
> As far as for the CDATA, since we need that in some other places (to escape
> the < >, etc.), we just use it consistently for the statement bodies
> (anywhere no ibatis keyword is used). That shouldn't hurt right?
>
>
>
> On 8/30/06, Larry Meadors <lm...@apache.org> wrote:
> > The remapResults attributes should only be required if the result
> > mapping (i.e., column list) changes.
> >
> > In the case you included, it should not be (nor should the CDATA section).
> >
> > Larry
> >
> >
> > On 8/30/06, Scott Zhu <sc...@gmail.com> wrote:
> > >
> > > In our application, we need to support dynamic table names, so our
> statement
> > > would look something like this:
> > >
> > >    <select id="getProductIndexByOfferId" remapResults="true"
> > > parameterClass="java.util.Map" resultMap="productIndexResult">
> > >       <![CDATA[
> > >       select p.ProductID
> > >       from $UA_ProductIndex$ p
> > >       where OfferID=#offerID#
> > >       ]]>
> > >    </select>
> > >
> > > If I understand it correctly, the remapResults is needed if the selected
> > > columns or table names can be different at statement execution time (in
> > > order to regenerate the prepared statement). In our case though, once we
> > > choose the table name, it will remain the same until we change the
> > > configuration (happens rarely). Since there's a performance hit by using
> > > this setting (remapResults), I wonder if it's possible for us not to set
> it.
> > > Then when the configuration is changed, is there a way we can force a
> reload
> > > of (all the) sqlmap statements on the fly (we don't have an option to
> bounce
> > > the app server)? I guess if not, I can still throw away the sqlclient
> > > instance and re-create it.
> > >
> > > Thanks.
> > >
> >
>
>

Re: remapResults setting and force a reload of sqlmap at runtime

Posted by Scott Zhu <sc...@gmail.com>.
Thanks for the quick response. So you are saying we don't need the
remapResults if just the table name is dynamic?

As far as for the CDATA, since we need that in some other places (to escape
the < >, etc.), we just use it consistently for the statement bodies
(anywhere no ibatis keyword is used). That shouldn't hurt right?


On 8/30/06, Larry Meadors <lm...@apache.org> wrote:
>
> The remapResults attributes should only be required if the result
> mapping (i.e., column list) changes.
>
> In the case you included, it should not be (nor should the CDATA section).
>
> Larry
>
>
> On 8/30/06, Scott Zhu <sc...@gmail.com> wrote:
> >
> > In our application, we need to support dynamic table names, so our
> statement
> > would look something like this:
> >
> >    <select id="getProductIndexByOfferId" remapResults="true"
> > parameterClass="java.util.Map" resultMap="productIndexResult">
> >       <![CDATA[
> >       select p.ProductID
> >       from $UA_ProductIndex$ p
> >       where OfferID=#offerID#
> >       ]]>
> >    </select>
> >
> > If I understand it correctly, the remapResults is needed if the selected
> > columns or table names can be different at statement execution time (in
> > order to regenerate the prepared statement). In our case though, once we
> > choose the table name, it will remain the same until we change the
> > configuration (happens rarely). Since there's a performance hit by using
> > this setting (remapResults), I wonder if it's possible for us not to set
> it.
> > Then when the configuration is changed, is there a way we can force a
> reload
> > of (all the) sqlmap statements on the fly (we don't have an option to
> bounce
> > the app server)? I guess if not, I can still throw away the sqlclient
> > instance and re-create it.
> >
> > Thanks.
> >
>

Re: remapResults setting and force a reload of sqlmap at runtime

Posted by Larry Meadors <lm...@apache.org>.
The remapResults attributes should only be required if the result
mapping (i.e., column list) changes.

In the case you included, it should not be (nor should the CDATA section).

Larry


On 8/30/06, Scott Zhu <sc...@gmail.com> wrote:
>
> In our application, we need to support dynamic table names, so our statement
> would look something like this:
>
>    <select id="getProductIndexByOfferId" remapResults="true"
> parameterClass="java.util.Map" resultMap="productIndexResult">
>       <![CDATA[
>       select p.ProductID
>       from $UA_ProductIndex$ p
>       where OfferID=#offerID#
>       ]]>
>    </select>
>
> If I understand it correctly, the remapResults is needed if the selected
> columns or table names can be different at statement execution time (in
> order to regenerate the prepared statement). In our case though, once we
> choose the table name, it will remain the same until we change the
> configuration (happens rarely). Since there's a performance hit by using
> this setting (remapResults), I wonder if it's possible for us not to set it.
> Then when the configuration is changed, is there a way we can force a reload
> of (all the) sqlmap statements on the fly (we don't have an option to bounce
> the app server)? I guess if not, I can still throw away the sqlclient
> instance and re-create it.
>
> Thanks.
>