I am writing new code to update a legacy AS400/iSeries/IBMi DB (DB2/400). I can't change the tables. I understand that Spring Data JPA can use optimistic locking via the @Version annotation, but this requires an existing field in the table to annotate.
DB2/400 has a feature already which increments each time a record is updated, e.g:
select row change token for mylib.table1 from mylib.table1 where someid=123
I am using (from my application.properties file):
spring.datasource.driver-class-name=com.ibm.as400.access.AS400JDBCDriver
spring.jpa.database-platform = org.hibernate.dialect.DB2400Dialect
What I would really like is for there to be a way of using the 'select row change token' feature as the version. Any ideas most welcome.
Thanks in advance.