ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: selectKey postgresql8 problem
Date Mon, 02 May 2005 14:58:06 GMT
Are you calling the insert mapped statement with the update method of the 
sql map client?

If you are, selectKey will not get called - it is only used when calling 
insert().

Larry


On 4/28/05, Darek Dober <dooverone@op.pl> wrote:
> 
> Hi,
> According to the documentation it should be easy but it isn't.
> The main problem is that, i don't see any sql statement of selectKey in 
> log of postgresql !!!
> When i make a mistake with keyProperty name, it also is correct for 
> ibatis. But when I replace
> KeyProperty with something else, or I make a mistake, syntax error is 
> arrisen.
>  Why the selectKey isn't invoked ?
>  With the previous version of jdbc driver (7.4) with database 8.01 and 
> Ibatis 2.00 I had the problem, that selectKey statement was invoked, but 
> it returned always 0
>  Postgresql: 8.01
> Jdbc driver: 8.0-311
> Ibatis 2.09b
>  Thanks
> Darek
>  <insert id="insertCustomerNew" parameterClass="customer">
> <selectKey resultClass="integer" keyProperty="addressId">
> SELECT cast(last_value as int) AS addressId
> FROM addresses_addr_id_seq
> </selectKey>
>   INSERT INTO ADDRESSES (
> ,ADDR_ID
> STREET
> ,PLACENO
> ,FLATNO
> .....
> )
> VALUES (
> #addressId#
> ,#addressStreet#
> ,#addressPlaceNo#
> ,#addressFlatNo#
> ,#addressCity#
> );
>   INSERT INTO CUSTOMERS (
> STAT_ID
> ,COMP_ID
> ,ADDR_ID
> ,NUMBER
> ......
> )
> VALUES (
> #stateId#
> ,#compId#
> ,#addressId#
> ,#number#
> ....
> );
> </insert>
>

Mime
View raw message