ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Stubbs <antony.stu...@gmail.com>
Subject Abator generates Inserts NULL into DB2 Indentity columns causes problem
Date Mon, 30 Apr 2007 12:00:31 GMT

The SQL that Abator generates try's to insert null into my identity columns
(eg car_id) which are auto-generated and 'not nullable'. 
DB2 doesn't like this, and throws and exception about putting null into
non-null columns.
To get around it i've been deleting from the generated sql's insert
statements the car_id column.

Is there a better way to get around this? I'm resonably new to DB2, and in
top of that we're moving the project to Oracle in a week or two.

Also - I'd rather like to avoid having to extend and modify the generator to
leave out this column. Can't abator see that it's an identity column and not
try to insert to it?

MySQL didn't seem to complain about the same thing. I guess it saw you were
trying to insert null, and inserted the generated value instead. Perhaps
there's a way to get that behaviour in db2?

This is an example table:

CREATE TABLE SHIFT ( 
	CAR_ID       	INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1,
INCREMENT BY 1, CACHE 20) NOT NULL)
-- 
View this message in context: http://www.nabble.com/Abator-generates-Inserts-NULL-into-DB2-Indentity-columns-causes-problem-tf3669298.html#a10252353
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message