Hi,
I'm trying to store objects (using PB) in a DB2 table where autoincrement is defined for the id column and I don't get it working.
This is the SQL I used to create the table:
CREATE TABLE ACTION
(
ID BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1, NO CACHE),
... other fields ...
PRIMARY KEY (ID) );
This is the OBJ Mapping I use for the object:
<field-descriptor
name="id"
column="id"
jdbc-type="BIGINT"
primarykey="true"
nullable="false"
access="readonly"
autoincrement="true"
>This is my class:
public class Action
{
private long id;... other properties ... }
When I use this sequence manager:
<sequence-manager className= "org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl"/>
then I get:
SQL failure while insert object data for class Action, PK of the given object is [ id=-2], object was [EMAIL PROTECTED], exception message is [[IBM][JDBC Driver] CLI0613E Program type out of range. SQLSTATE=S1003]
When I use this sequence manager:
<sequence-manager className= "org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
<attribute attribute-name="autoNaming" attribute-value="true"/>
</sequence-manager>
then I get:
SQL failure while insert object data for class Action, PK of the given object is [ id=22], object was [EMAIL PROTECTED], exception message is [[IBM][JDBC Driver] CLI0613E Program type out of range. SQLSTATE=S1003]
=> in this on every try the [ id=..] is incremented in the error message.
When I try to insert a record via SQL and do not specify the ID column it works fine.
Any ideas or suggestions?
Thanks in advance, Sebastian
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
