MybatisPlusInterceptor
OptimisticLockerInnerInterceptor
@Deprecated
@Intercepts(value=@Signature(type=org.apache.ibatis.executor.Executor.class,method="update",args={org.apache.ibatis.mapping.MappedStatement.class,java.lang.Object.class}))
public class OptimisticLockerInterceptor
extends java.lang.Object
implements org.apache.ibatis.plugin.Interceptor
Intercept on Executor
.update;
Support version types: int/Integer, long/Long, java.util.Date, java.sql.Timestamp
For extra types, please define a subclass and override getUpdatedVersionVal
() method.
How to use?
(1) Define an Entity and add Version
annotation on one entity field.
(2) Add OptimisticLockerInterceptor
into mybatis plugin.
How to work?
if update entity with version column=1:
(1) no OptimisticLockerInterceptor
:
SQL: update tbl_test set name='abc' where id=100001;
(2) add OptimisticLockerInterceptor
:
SQL: update tbl_test set name='abc',version=2 where id=100001 and version=1;
构造器和说明 |
---|
OptimisticLockerInterceptor()
已过时。
|
限定符和类型 | 方法和说明 |
---|---|
protected java.lang.Object |
getUpdatedVersionVal(java.lang.Class<?> clazz,
java.lang.Object originalVersionVal)
已过时。
This method provides the control for version value.
|
java.lang.Object |
intercept(org.apache.ibatis.plugin.Invocation invocation)
已过时。
|
java.lang.Object |
plugin(java.lang.Object target)
已过时。
|
public java.lang.Object intercept(org.apache.ibatis.plugin.Invocation invocation) throws java.lang.Throwable
intercept
在接口中 org.apache.ibatis.plugin.Interceptor
java.lang.Throwable
protected java.lang.Object getUpdatedVersionVal(java.lang.Class<?> clazz, java.lang.Object originalVersionVal)
originalVersionVal
- ignorepublic java.lang.Object plugin(java.lang.Object target)
plugin
在接口中 org.apache.ibatis.plugin.Interceptor