@Documented @Target(value=FIELD) @Retention(value=RUNTIME) public @interface Column
| 限定符和类型 | 可选元素和说明 |
|---|---|
String |
comment |
String |
defaultValue |
boolean |
extCanUpdate
扩展注解和数据库无关
指定字段是否允许参与更新操作
只在
Session 中 方法updateObject有效 |
String |
extDecimalFormat
扩展注解和数据库无关
用于改变浮点数字的格式,比如
.00 保留两位小数
|
long |
extMinLength
扩展注解和数据库无关
用于校验数据最小长度
|
String |
extRegExp
扩展注解和数据库无关
用于校验字符串是否符合正则表达式
|
boolean |
index
是否在创建表时创建索引
|
int |
length |
String |
name |
boolean |
nullable |
boolean |
pk
当前字段是否是主键
如果一个映射类有多个pk则作为符合主键
|
int |
scale
字段限制和length是一样的效果
但是length只能指定字段长度,这个限定更广泛
比如 Mysql的BigDecimal类型可以传入 32,2
|
Class<? extends IDStrategy> |
strategy |
boolean |
timeForUpdate
创建一个时间类型字段,在任何更新添加时都会更新时间,示例SQL如下:
`modified_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间'
|
Class<?> |
type
Integer or int.class
String
Character or char.class
Blob
SupportBlob
SupportMediumBlob
SupportLongBlob
SupportText
SupportMediumText
SupportLongText
Byte or byte.class
Short or short.class
Long or long.class
Float or float.class
Double or double.class
BigDecimal
Boolean or boolean.class
Date
Time
Date
Timestamp |
boolean |
unique
是否全局唯一
只支持单表,在分表情况下使用也只是某个单表有效
|
public abstract Class<? extends IDStrategy> strategy
public abstract String name
public abstract Class<?> type
Integer or int.class
String
Character or char.class
Blob
SupportBlob
SupportMediumBlob
SupportLongBlob
SupportText
SupportMediumText
SupportLongText
Byte or byte.class
Short or short.class
Long or long.class
Float or float.class
Double or double.class
BigDecimal
Boolean or boolean.class
Date
Time
Date
Timestamppublic abstract int scale
public abstract String comment
public abstract boolean timeForUpdate
public abstract String defaultValue
public abstract String extDecimalFormat
public abstract String extRegExp
public abstract boolean extCanUpdate
Session 中 方法updateObject有效Copyright © 2020. All rights reserved.