ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zarar Siddiqi" <zarar.sidd...@utoronto.ca>
Subject Re: Trying to understand selectKey
Date Fri, 30 Sep 2005 20:42:57 GMT
Larry made a typo.  It's keyProperty, not property.  Just look at the docs 
its all there.

Here is a working example currently in production and working fine for me.

    <insert id="insertFilter">
        INSERT INTO mcc_filter ("Name","DateCreated") VALUES (#name#, 
        <selectKey keyProperty="id" resultClass="int">
            select currval('"mcc_filter_Id_seq"');

The only difference is that I don't have nextval('mcc_filter_Id_seq') as my 
default value for the Id field in the mcc_filter table.  Instead, I created 
the mcc_filter table with Id of type SERIAL and it automatically created the 
mcc_filter_Id_seq for me.  So my default value in the field is blank but the 
relationship still exists.

----- Original Message ----- 
From: "Alan Chandler" <alan@chandlerfamily.org.uk>
To: <user-java@ibatis.apache.org>
Sent: Friday, September 30, 2005 4:23 PM
Subject: Re: Trying to understand selectKey

> 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

View raw message