Ben, Seems to me that you're using a sequence that gives you integer values, aren't you? So, why does your pk column has type VARCHAR(20)? If your database is Oracle, i bet the problem is happening due to converting an integer to a string and then back. What happens if you replace your #id# in the VALUES list with the call of the sequence?
Cheers, Daniel Silva. --- Ben Gill <[EMAIL PROTECTED]> wrote: > Yeah I tried that... in fact I have tried a whole nuch of things but cannot > get it to work!! > > I am now using: > > <typeAlias alias="offence" > type="com.ocado.tracker.offences.forms.OffenceForm"/> > > <insert id="addOffence" parameterClass="offence"> > <selectKey resultClass="java.lang.String" keyProperty="id" > > SELECT OFFENCES_SEQ.NEXTVAL AS ID FROM DUAL > </selectKey> > > insert into > OFFENCES (OFFENCE_UUID, STATUS, AUTHORITY, TICKET_NUMBER, > OFFENCE, > EMPLOYEE_UUID, DATETIME_OF_OFFENCE, DATETIME_OF_TICKET, > SITE, FLEET_UUID, LOC_OF_OFFENCE, POSTCODE, FINE, > ORDER_NUMBER, > ROUTE_ID, ENTERED_BY, ASSIGNED_TO, LAST_MODIFIED_BY, > LAST_MODIFIED, > CREATION_DATE) > values (#id#, 'new', #authority#, #ticketNumber#, #offence#, > #employeeID#, to_date(#dateOfOffence#,'dd/mm/YYYY HH24:mi'), > to_date(#dateOfTicket#,'dd/mm/YYYY HH24:mi'), > #site#, #fleetID#, #locOfOffence#, #postcode#, #fine#, > #orderNumber#, #routeID#, #enteredBy#, #assignedTo#, > sysdate, sysdate); > </insert> > > org.springframework.jdbc.UncategorizedSQLException: (SqlMapClient > operation): en > countered SQLException [ > --- The error occurred in com/ocado/tracker/offences/dao/sql/OffenceSQL.xml. > --- The error occurred while applying a parameter map. > --- Check the addOffence-InlineParameterMap. > --- Check the parameter mapping for the 'id' property. > --- Cause: java.sql.SQLException: Invalid column type]; nested exception is > com. > ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in com/ocado/tracker/offences/dao/sql/OffenceSQL.xml. > --- The error occurred while applying a parameter map. > --- Check the addOffence-InlineParameterMap. > --- Check the parameter mapping for the 'id' property. > --- Cause: java.sql.SQLException: Invalid column type > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in com/ocado/tracker/offences/dao/sql/OffenceSQL.xml. > --- The error occurred while applying a parameter map. > --- Check the addOffence-InlineParameterMap. > --- Check the parameter mapping for the 'id' property. > --- Cause: java.sql.SQLException: Invalid column type > Caused by: java.sql.SQLException: Invalid column type > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUp > date(GeneralStatement.java:86) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExe > cutorDelegate.java:500) > at > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionI > mpl.java:89) > > -----Original Message----- > From: Aitor Imaz [mailto:[EMAIL PROTECTED] > Sent: 04 February 2005 12:19 > To: [email protected] > Subject: Re: Mapping Problem > > > I can see one thing, in your <selectKey> the resultClass attribute > should be a String if I'm not wrong. You should put there the class of > the primary key returned, not of the object itself. Maybe that's the > cause of the error (the selectkey mapping)? > > Hope it helps, > Aitor > > > _____________________________________________________________________ > This message has been checked for all known viruses by the > MessageLabs Virus Control Centre. > > This message has been checked for all known viruses by the MessageLabs Virus > Control Centre. > > > ********************************************************************* > > Notice: This email is confidential and may contain copyright material of > Ocado Limited (the > "Company"). Opinions and views expressed in this message may not necessarily > reflect the > opinions and views of the Company. > If you are not the intended recipient, please notify us immediately and > delete all copies of > this message. Please note that it is your responsibility to scan this message > for viruses. > > Company reg. no. 3875000. > Ocado Limited > Titan Court > 3 Bishops Square > Hatfield Business Park > Hatfield > Herts > AL10 9NE > > > ********************************************************************* > __________________________________ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250

