在实体类使用数据库默认值的字段设置
@Column(name = "yourName",insertable = false)
在生成insert语句时会忽略字段(JPA下未测试)
示例如下, 具体描述可以看javax.persistence.Column 源码。
package cn.aps.entity;
import lombok.Data;
import tk.mybatis.mapper.annotation.KeySql;
import tk.mybatis.mapper.code.ORDER;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author 구영강
* @version 1.0
* @date 2020/1/7 13:16
*/
@Data
@Table(name = "WIP_LOT")
public class WipLot {
@Id
@Column(name = "UPDATE_TIME",insertable = false)
private String updateTime;
private String technology;
private String grade;
private Integer processSeq;
private Integer version;
private String createUser;
@Column(name = "CREATE_TIME",insertable = false)
private String createTime;
private String updateUser;
}