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 esemba <es...@gmail.com> on 2009/03/30 20:44:42 UTC
dynamic prepend problem
Hi,
I have this sql map:
...
<dynamic prepend="union">
<isNotNull property="queryFulltext" removeFirstPrepend="false">
select theses.id as id,
...
...
where theses_documents.index @@ to_tsquery('cs', #queryFulltext#)
<isNotNull property="categoryId" prepend="and">
theses_categories.id = #categoryId#
</isNotNull>
</isNotNull>
</dynamic>
...
This sql map throws me an sytax error.
When I check SQL code ibatis has generated, i can see, that last prepend
(AND) is not generated.So the query looks like:
where theses_documents.index @@ to_tsquery('cs', #queryFulltext#)
[HERE SHOULD BE AND, BUT ISN'T] theses_categories.id = #categoryId#
Can somebody show me a direction? I have read carefuly the definitions in
Ibatis in action (when the prepends are included and when not), but can't
understant why this happens. Thank you.
--
View this message in context: http://www.nabble.com/dynamic-prepend-problem-tp22790132p22790132.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: dynamic prepend problem
Posted by esemba <es...@gmail.com>.
Hi,
ibatis uses commons logging and I use log4j in my application. So you only
need set DEBUG level for ibatis and check the log for generated statements.
Lukas
omnipresent wrote:
>
> your question is already answered but could you tell me how can you see
> the
> sql code that ibatis generates?
>
>
--
View this message in context: http://www.nabble.com/dynamic-prepend-problem-tp22790132p22791861.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: dynamic prepend problem
Posted by Bhaarat Sharma <bh...@gmail.com>.
your question is already answered but could you tell me how can you see the
sql code that ibatis generates?
On Mon, Mar 30, 2009 at 2:56 PM, esemba <es...@gmail.com> wrote:
>
> Thanks, I guess I'm kind of overworked today :)
> Do you know why my example doesn't work?
>
>
> Larry Meadors wrote:
> >
> > Why not just say this:
> >
> > <isNotNull property="categoryId">
> > and theses_categories.id = #categoryId#
> > </isNotNull>
> >
> > Larry
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/dynamic-prepend-problem-tp22790132p22790412.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
Re: dynamic prepend problem
Posted by esemba <es...@gmail.com>.
Thanks, I guess I'm kind of overworked today :)
Do you know why my example doesn't work?
Larry Meadors wrote:
>
> Why not just say this:
>
> <isNotNull property="categoryId">
> and theses_categories.id = #categoryId#
> </isNotNull>
>
> Larry
>
>
--
View this message in context: http://www.nabble.com/dynamic-prepend-problem-tp22790132p22790412.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: dynamic prepend problem
Posted by Larry Meadors <la...@gmail.com>.
Why not just say this:
<isNotNull property="categoryId">
and theses_categories.id = #categoryId#
</isNotNull>
Larry