This is probably a result of using some iBATIS 2.0 elements inside an iBATIS 1.0 sql map. You need to consistently use the version 2.0 DTD like this:
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="Organizations">
<insert id="InsertOrganization" parameterClass="Organization"
resultClass="int">
<selectKey property="Id" type="post" resultClass="int">
SELECT LAST_INSERT_ID() AS value
</selectKey>
INSERT INTO Organizations
(Org_Code, Org_Name)
VALUES
(#Code#, #Name#)
</insert>
</sqlMap>
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="Organizations">
<insert id="InsertOrganization" parameterClass="Organization"
resultClass="int">
<selectKey property="Id" type="post" resultClass="int">
SELECT LAST_INSERT_ID() AS value
</selectKey>
INSERT INTO Organizations
(Org_Code, Org_Name)
VALUES
(#Code#, #Name#)
</insert>
</sqlMap>
Jeff Butler
On 5/16/06, xianwinwin <[EMAIL PROTECTED]> wrote:
thank you for your reply Jeff.
I looked at the documentation and tried (unsuccessfully) some of the
examples.
I tried somthing that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sql-map
PUBLIC "-//iBATIS.com//DTD SQL Map 1.0//EN"
" http://www.ibatis.com/dtd/sql-map.dtd">
<sql-map name="Organizations">
<insert id="InsertOrganization" parameterClass="Organization"
resultClass="int">
<selectKey property="Id" type="post" resultClass="int">
SELECT LAST_INSERT_ID() AS value
</selectKey>
INSERT INTO Organizations
(Org_Code, Org_Name)
VALUES
(#Code#, #Name#)
</insert>
</sql-map>
I keep getting the following error cause: Element "sqlMap" requires
additional elements.
any idea?
--
View this message in context: http://www.nabble.com/get-id-with-iBatis-%28Statement.RETURN_GENERATED_KEYS%29-t1629789.html#a4415947
Sent from the iBATIS - User - Java forum at Nabble.com.
