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 JJ Stuart <jj...@yahoo.com> on 2009/12/18 14:44:57 UTC
Stored Procedures iBatis version 3 beta
I'm a newbie to iBatis and am currently trying to call a parameterised stored
procedure using v3.5 beta of iBatis.
The following mapping works with a hardcoded value
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="test.TestMapper">
<select id="selectAll" resultType="LoadStageTest"
parameterType="java.lang.Integer">
{call test_proc3 (102)}
</select>
</mapper>
However if I then try to pass a value in using below (inline param)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="test.TestMapper">
<select id="selectAll" resultType="LoadStageTest"
parameterType="java.lang.Integer">
{call test_proc3 (#value#)}
</select>
</mapper>
i get the following error
### Error querying database. Cause:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error
in your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near '' at line 1
Any help appreciated,
Many thanks
Jonathan
--
View this message in context: http://old.nabble.com/Stored-Procedures-iBatis-version-3-beta-tp26843638p26843638.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: Stored Procedures iBatis version 3 beta
Posted by JJ Stuart <jj...@yahoo.com>.
JJ Stuart wrote:
>
> All working now.
>
> Many thanks
>
--
View this message in context: http://old.nabble.com/Stored-Procedures-iBatis-version-3-beta-tp26843638p26871688.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: Stored Procedures iBatis version 3 beta
Posted by Clinton Begin <cl...@gmail.com>.
You might want to check out the new documentation. The new parameter format
is: #{param}, not #param#
On Fri, Dec 18, 2009 at 6:44 AM, JJ Stuart <jj...@yahoo.com> wrote:
>
> I'm a newbie to iBatis and am currently trying to call a parameterised
> stored
> procedure using v3.5 beta of iBatis.
>
> The following mapping works with a hardcoded value
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE mapper
> PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
> "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
> <mapper namespace="test.TestMapper">
>
>
>
> <select id="selectAll" resultType="LoadStageTest"
> parameterType="java.lang.Integer">
> {call test_proc3 (102)}
> </select>
> </mapper>
>
>
> However if I then try to pass a value in using below (inline param)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE mapper
> PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
> "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
> <mapper namespace="test.TestMapper">
>
>
>
> <select id="selectAll" resultType="LoadStageTest"
> parameterType="java.lang.Integer">
> {call test_proc3 (#value#)}
> </select>
> </mapper>
>
>
> i get the following error
>
> ### Error querying database. Cause:
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an
> error
> in your SQL syntax; check the manual that corresponds to your MySQL server
> version for the right syntax to use near '' at line 1
>
> Any help appreciated,
>
> Many thanks
>
> Jonathan
>
> --
> View this message in context:
> http://old.nabble.com/Stored-Procedures-iBatis-version-3-beta-tp26843638p26843638.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>