ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: Trying to understand selectKey
Date Fri, 30 Sep 2005 20:46:25 GMT
The property attribute is valid in IBatisNet. For Java, try
keyProperty:

 <selectKey keyProperty="personId" resultClass="java.lang.Integer">
  SELECT curval('persons_id_seq')
 </selectKey>

Unless I missed something, the iBATIS-SqlMaps-2.pdf file from 5/5/2005
didn't mention keyProperty anywhere.

This should also work:

 Person aPerson = new Person();
 aPerson.setFirstname("Joe");
 aPerson.setLastname("Bloggs")
 Integer anID = (Integer)sqlMap.insert("insert", aPerson);
 aPerson.setPersonId(anID);

--- Alan Chandler <alan@chandlerfamily.org.uk> wrote:

> On Friday 30 Sep 2005 19:57, Larry Meadors wrote:
> > You would do this (or close):
> >
> > <insert id="insert">
> >  INSERT INTO person (lastname, firstname) values (#lastname#,
> #firstname#)
> >  <selectKey property="personId">SELECT
> curval('persons_id_seq')</selectKey>
> > </insert>
> 
> the property attribute of <selectKey> is wrong - Eclipse is throwing
> it out as 
> an error
> 
> -- 
> Alan Chandler
> http://www.chandlerfamily.org.uk
> 


Mime
View raw message