Whoops - my bad: http://ibatis.apache.org/docs/tools/abator/configreference/generatedKey.html
Seems to behave nicely now :) "The <generatedKey> Element The <generatedKey> element is used to specify properties for auto generated keys (from identity field or sequences). If you specify this element, Abator will generate an appropriate <selectKey> element inside the generated <insert> element in the SQL map. This element is an optional child element of the <table> element." Antony Stubbs wrote: > > 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#a10252800 Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
