数据库访问
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.3 KiB

4 years ago
package com.fr.plugin.entity;
import com.fr.stable.db.entity.BaseEntity;
import com.fr.third.javax.persistence.Column;
import com.fr.third.javax.persistence.Entity;
import com.fr.third.javax.persistence.Table;
import java.util.Date;
//第一步添加这两个注解,特别是table的name属性要唯一,并将类继承到BaseEntity,会自动生产id字段
@Entity
@Table(
name = "zzl_my_table"
)
public class MyEntity extends BaseEntity {
//第二步注册要使用的字段加上@Column注解
@Column(
name = "userName",
unique = true
// scale = 0,
// length = 255
)
private String userName;
@Column(
name = "source"
)
private Integer source;
@Column(
name = "createTime"
)
private Date createTime;
//第三步生成对应的get和set
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}