Does anyone here have experience with JPA/DB2 mapping?
I have tried many things but I cannot get it work properly. I am working with JPA and DB2 database for AS400.
Below are the 2 my mapping files possibilities I have tried:
- Mapping 1: using sequence
- Error from Mapping 1 :
* org.hibernate.exception.SQLGrammarException: could not get next sequence value
* java.sql.SQLException: [SQL0029] INTO clause missing from embedded statement.
- Mapping 2 : using Identity
- Error from Mapping 2:
* util.JDBCExceptionReporter [SQL0798] Value cannot be specified for GENERATED ALWAYS column ID.
* org.hibernate.util.JDBCExceptionReporter - [SQL0798] Value cannot be specified for GENERATED ALWAYS column ID.
My question is has anyone worked with JPA / DB2? If you do, how did you configure your database table and jpa? Did you use sequence or identity?
I've got some experience of using JPA with the AS/400, which I hope will be of some help.
The choice between SEQUENCE and IDENTIFIER comes down to whether you can modify the existing table or not.
If you are in a position where you can alter the table, then you can add an identifier column to it, like so: