ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darek Dober" <doover...@op.pl>
Subject selectKey postgresql8 problem
Date Thu, 28 Apr 2005 15:17:37 GMT
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