Why not this: <select id="getNextVal" resultClass="java.lang.Integer"> select $seq_name$.nextval from dual </select>
Larry On 3/20/06, Marco Berri <[EMAIL PROTECTED]> wrote: > I'M Using this: > > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" > "$iBatisStoragePath$/sql-map-2.dtd"> > <sqlMap namespace="sequence"> > > <select id="getNextVal" resultClass="java.lang.Integer"> > select $seq_name$.nextval from tnes2.tnode where rownum=1 > </select> > > </sqlMap> > > where tnes2.tnode is a table on my db. > > > > > Larry Meadors wrote: > > Also..make sure you are inserting with insert(), not update(). > > > > Larry > > > > > > On 3/18/06, Eric T. Blue <[EMAIL PROTECTED]> wrote: > > > >>Hi, > >> > >> I believe your selectkey property name must match the #property# you are > >>using for the insert statement. So, you can either replace #seqId# with > >>#personId#, or rename the selectKey property to seqId. Also, I'm not > >>certain if this has changed, but in the past when I've used selectKey the > >>attribute for naming the key is keyProperty not property. > >> > >> > >>On 3/18/06, Shardayyy <[EMAIL PROTECTED]> wrote: > >> > >>> > >>> > >>> > >>>Hey folks, > >>> > >>> > >>> > >>> > >>> > >>>I am having a problem getting this to work. Any help would be appreciated. > >> > >>What am trying to do is insert a person and return the Id that was used in > >>inserting the person. > >> > >>> > >>> > >>>Target Database is Oracle 9.2 > >>> > >>>iBatis Version 2.1.7 - Jan 21, 2006 > >>> > >>> > >>> > >>> > >>> > >>> <insert id="savePerson" parameterClass="PersonObject" > >> > >>resultClass="int" > >> > >>> <selectKey property="personId" type="pre" resultClass= > >>>"int"> > >>> > >>> > >>> select SEQ_PERSON.nextval as seqId from dual > >>> > >>> </selectKey> > >>> > >>> INSERT INTO PERSON_TBL ( personId, name, age,gender) VALUES > >> > >>(#seqId#, #name#, #age#, #gender#) > >> > >>> </insert> > >>> > >>> > >>> > >>>Error message is: > >>> > >>> > >>> > >>> > >>> > >>> > >> > >> > > > > >
