Safe, High performance, reuseable

Monday, July 21, 2008

About using jpa @GeneratedValue

Database Side:
1 . DB2 database
2. id field using "value generationg->identity"

JPA side:

1. ID field must use "@Id @GeneratedValue(strategy = GenerationType.IDENTITY)"
Otherwise the following error will be raised:

Internal Exception: com.ibm.db2.jcc.b.nm: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=SWAT.SEQUENCE, DRIVER=3.50.152Error Code: -204Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind => [50, SEQ_GEN]Query: DataModifyQuery()

No comments: