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 Amad Fida <am...@yahoo.com> on 2005/12/25 00:01:35 UTC
SQL Query as variable
Hi,
I have following problem on hand and wondering if iBatis provides anything here. I have two tables with 95% similar columns, in fact at domain object level one extends from the other. For resultMaps I use âextendsâ and I can avoid duplicating lot of sqlmaps. Now the question is insert and update statements. As âextendsâ doesnât make sense for these so I was wondering if there is anything that I can do to put the common sql (columns names, value paramters) in some sort of variable and use these variable in my actual sql statement in a map? This way I can keep one copy and make sure these maps always share common columns. If you are wondering why i have two tables like that, think of them as production tables an reporting tables.
Thanks
Amad
---------------------------------
Yahoo! Shopping
Find Great Deals on Holiday Gifts at Yahoo! Shopping
Re: SQL Query as variable
Posted by Amad Fida <am...@yahoo.com>.
Thanks Jeff, this is exactly i was looking for.
Amad
Jeff Butler <je...@gmail.com> wrote: Sounds like the <sql> and <include> tags are what you need. See this FAQ:
http://opensource2.atlassian.com/confluence/oss/pages/viewpage.action?pageId=707
Jeff Butler
On 12/24/05, Amad Fida <am...@yahoo.com> wrote: Hi,
I have following problem on hand and wondering if iBatis provides anything here. I have two tables with 95% similar columns, in fact at domain object level one extends from the other. For resultMaps I use "extends" and I can avoid duplicating lot of sqlmaps. Now the question is insert and update statements. As "extends" doesn't make sense for these so I was wondering if there is anything that I can do to put the common sql (columns names, value paramters) in some sort of variable and use these variable in my actual sql statement in a map? This way I can keep one copy and make sure these maps always share common columns. If you are wondering why i have two tables like that, think of them as production tables an reporting tables.
Thanks
Amad
---------------------------------
Yahoo! Shopping
Find Great Deals on Holiday Gifts at Yahoo! Shopping
---------------------------------
Yahoo! for Good - Make a difference this year.
Re: SQL Query as variable
Posted by Jeff Butler <je...@gmail.com>.
Sounds like the <sql> and <include> tags are what you need. See this FAQ:
http://opensource2.atlassian.com/confluence/oss/pages/viewpage.action?pageId=707
Jeff Butler
On 12/24/05, Amad Fida <am...@yahoo.com> wrote:
>
> Hi,
> I have following problem on hand and wondering if iBatis provides anything
> here. I have two tables with 95% similar columns, in fact at domain object
> level one extends from the other. For resultMaps I use "extends" and I can
> avoid duplicating lot of sqlmaps. Now the question is insert and update
> statements. As "extends" doesn't make sense for these so I was wondering if
> there is anything that I can do to put the common sql (columns names, value
> paramters) in some sort of variable and use these variable in my actual sql
> statement in a map? This way I can keep one copy and make sure these maps
> always share common columns. If you are wondering why i have two tables like
> that, think of them as production tables an reporting tables.
> Thanks
> Amad
>
> ------------------------------
> Yahoo! Shopping
> Find Great Deals on Holiday Gifts at Yahoo! Shopping<http://us.rd.yahoo.com/mail_us/footer/shopping/*http://shopping.yahoo.com/;_ylc=X3oDMTE2bzVzaHJtBF9TAzk1OTQ5NjM2BHNlYwNtYWlsdGFnBHNsawNob2xpZGF5LTA1+%0A>
>
>