从 jOOQ 手册 来看,至少对我来说,如何正确配置乐观锁并不清楚。
它实际上是什么意思?有人能提供一个例子吗?
例如,想象一下如果有这张表:
我应该在pom.xml文件中放什么内容到
<!-- All table and view columns that are used as "version" fields for
optimistic locking (A Java regular expression. Use the pipe to separate several expressions).
See UpdatableRecord.store() and UpdatableRecord.delete() for details -->
<recordVersionFields>REC_VERSION</recordVersionFields>
and below
recordVersionFields: Relevant methods from super classes are overridden to return the VERSION field
它实际上是什么意思?有人能提供一个例子吗?
例如,想象一下如果有这张表:
CREATE TABLE "users" (
"id" INTEGER DEFAULT nextval('global_seq') NOT NULL,
"code" TEXT NOT NULL,
"version" INTEGER NOT NULL
);
我应该在pom.xml文件中放什么内容到
recordVersionFields
中呢?<database>
<inputSchema>PUBLIC</inputSchema>
<recordVersionFields>users.version</recordVersionFields>
</database>
users.version
, version
, RECORD_VERSION
是什么意思?
我使用H2数据库,如果我只设置version
,则会出现编译错误。
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/JooqDemo/target/generated-sources/jooq-h2/org/jooqdemo/generated/tables/SchemaVersion.java:[152,52] getRecordVersion() in org.jooqdemo.generated.tables.SchemaVersion cannot implement getRecordVersion() in org.jooq.Table
return type org.jooq.TableField<org.jooqdemo.generated.tables.records.SchemaVersionRecord,java.lang.String> is not compatible with org.jooq.TableField<org.jooqdemo.generated.tables.records.SchemaVersionRecord,? extends java.lang.Number>