ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "D. Richter" <dr-iba...@gmx.de>
Subject Re: Missing Type-Conversion with Postgres-Jdbc-Driver 8.1-407
Date Fri, 17 Nov 2006 17:26:59 GMT
selectKey has to return the type of the Java-Object-Member, so string
is ok (int doesn't work). If I choose the type int for the member id, 
then it works too, but the String should be converted, because I specified
the destination-type as INTEGER.

Thank You
Dennis

-------- Original-Nachricht --------
Datum: Fri, 17 Nov 2006 09:41:04 -0700
Von: "Brandon Goodin" <brandon.goodin@gmail.com>
An: user-java@ibatis.apache.org
Betreff: Re: Missing Type-Conversion with Postgres-Jdbc-Driver 8.1-407

> you selectKey is returning a "string". shouldn't it return an "integer"?
> 
> Brandon
> 
> On 11/17/06, dr-ibatis@gmx.de <dr-ibatis@gmx.de> wrote:
> >
> > Hello,
> >
> > I have the following problem:
> >
> > I have a simple object
> >
> > public class MyObject {
> > private String id = "";
> > public String getId() { return id; }
> > public void setId(String id) { this.id = id; }
> > }
> >
> > , a database with a table
> >
> > CREATE TABLE myobject(id serial NOT NULL)
> >
> > and a map-file
> >
> > <sqlMap>
> > <parameterMap id="MyObjectParameter" class="main.MyObject">
> >   <parameter property="id" jdbcType="INTEGER"/>
> > </parameterMap>
> > <insert id="insertMyObject" parameterMap="MyObjectParameter">
> >   <selectKey keyProperty="id" resultClass="string">SELECT
> > nextval('myobject_id_seq')</selectKey>
> >   INSERT INTO myobject (id) VALUES (?)
> > </insert>
> > </sqlMap>
> >
> >
> > With the Postgres-Jdbc-Driver 7.4.213 everything is ok,
> > but with 8.1-407-Driver I get an exception
> > ERROR: column "id" is of type integer but expression is of type
> character
> > varying
> > though I have set the jdbcType to INTEGER. So it seems, that there
> > is no conversion done. What have I done wrong?
> >
> > Thank you
> > Dennis
> > --
> > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
> >

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

Mime
View raw message