tried all the generation strategies (table, sequence, identity) and had problem with the identity strategy only.
the problem comes up with the geberated statement:
CREATE TABLE PERSON( ID BIGINT PRIMARY KEY , NAME VARCHAR(128), AGE INTEGER, WEIGHT DOUBLE )
it is invalid since primary key cannot be null
in db2 it should be something like this:
CREATE TABLE PERSON (ID INTEGER GENERATED ALWAYS AS IDENTITY NOT NULL, NAME VARCHAR(128), AGE INTEGER, WEIGHT FLOAT, PRIMARY KEY (ID))
created this table manually and tried the persist() method.
the generated prepared statement is ok:
insert into PERSON (NAME,AGE,WEIGHT) values ( ? , ? , ? )
but after this the following query is called:
select @@IDENTITY
which is invalid and will cause an sqlexception
|