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 Jonathan Alvarsson <jo...@gmail.com> on 2008/05/28 11:33:24 UTC

"doing a bitwise AND" or "iBatis catches &?"

I am trying to perform bitwise AND in a select statement. I think the syntax
would be something like:

    <select id="Structure.fingerPrintSubsetSearch"
            resultMap="Structure"
            parameterClass="java.util.Map">
        SELECT
            <include refid="BaseObject-fields" />,
            <include refid="Structure-fields"  />
        FROM
            Structure s INNER JOIN BaseObject b ON
            s.baseObject = b.id
        WHERE
            s.persistedFingerprint & #param:BINARY# = #param:BINARY#
    </select>

But I am not sure about it. One problem is that the XML-parser says: "The
entity name must immediately follow the '&' in the entity reference." so I
can't really see what my database system thinks about it (HSQLDB) Perhaps
you can help me? My param is a byte[] btw...

-- 
// Jonathan

Re: "doing a bitwise AND" or "iBatis catches &?"

Posted by Tom Schindl <to...@bestsolution.at>.
Because the XML use & as the start for Entities you'll need to write 
&amp; instead of &.

Tom

Jonathan Alvarsson schrieb:
> I am trying to perform bitwise AND in a select statement. I think the 
> syntax would be something like:
> 
>     <select id="Structure.fingerPrintSubsetSearch"
>             resultMap="Structure"
>             parameterClass="java.util.Map">
>         SELECT
>             <include refid="BaseObject-fields" />,
>             <include refid="Structure-fields"  />
>         FROM
>             Structure s INNER JOIN BaseObject b ON
>             s.baseObject = b.id <http://b.id>
>         WHERE
>             s.persistedFingerprint & #param:BINARY# = #param:BINARY#
>     </select>
> 
> But I am not sure about it. One problem is that the XML-parser says: 
> "The entity name must immediately follow the '&' in the entity 
> reference." so I can't really see what my database system thinks about 
> it (HSQLDB) Perhaps you can help me? My param is a byte[] btw...
> 
> -- 
> // Jonathan


-- 
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl                               leiter softwareentwicklung/CSO
------------------------------------------------------------------------
eduard-bodem-gasse 8/3    A-6020 innsbruck      phone    ++43 512 935834