The DB2-express is throwing an error that seems impossible, when JPA tries to persist an entity:
ReportingSQLException: "ITEMID" is not valid in the context where it is used..
INSERT INTO NULLID."DynamicDatabaseTable" ("colname", "rownumber", "value")
VALUES (?, ?, ?) [params=?, ?, ?]
Since ITEMID is not used in the query above, how can this error be? The ITEMID is an auto-identity-generated column.
I have tried executing manually the query and it works OK, so anybody know what's all about? Even after lot of googling, I'm totally clueless here.
The database table in DB2 is fine, I have triple check:
"itemid" BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH 1...),
"rownumber" BIGINT NOT NULL,
"colname" CHAR(30 OCTETS) NOT NULL,
"value" VARCHAR(254 OCTETS)
I had created a simple java "JPA Entity from a table", by using the Eclipse wizard, and I've triple check the class is fine.
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="\"itemid\"", unique=true, nullable=false)
private long itemid;
@Column(name="\"rownumber\"", nullable=false)
private long rownumber;
@Column(name="\"colname\"", nullable=false, length=30)
private String colname;
@Column(name="\"value\"", length=254)
private String value;
I have also restarted the whole computer just in case, but nothing... And I'm using most recent versions, clean installed couple of weeks ago.