ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: selectKey postgresql8 problem
Date Thu, 28 Apr 2005 15:34:09 GMT
The driver would need to support multiple inserts with a single
prepared statement. You might try breaking out the inserts into tow
different inserts. Try breaking it out into two seperate inserts.

Brandon

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