请各位大师把下面这些注解一一进行解释:
@Entity@Table(name="student")publicclassStudentimplementsSerializable{privatestaticfi...
@Entity
@Table(name = "student")
public class Student implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Integer id;
@Column(name = "name")
private String user;
@Column(name = "psw")
private String psw; 展开
@Table(name = "student")
public class Student implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Integer id;
@Column(name = "name")
private String user;
@Column(name = "psw")
private String psw; 展开
2个回答
展开全部
@Entity //这个是个实体的意思必须要有的
@Table(name = "student") 生成一个表名为student的表
public class Student implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)//表中对应的字段id 自增的,不能为空,name属性也可以不写,会自动生成和你属性名字一样的字段
private Integer id;
@Column(name = "name")对应表中字段为name
private String user;
@Column(name = "psw")对应表中字段为psw
private String psw;
@Table(name = "student") 生成一个表名为student的表
public class Student implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)//表中对应的字段id 自增的,不能为空,name属性也可以不写,会自动生成和你属性名字一样的字段
private Integer id;
@Column(name = "name")对应表中字段为name
private String user;
@Column(name = "psw")对应表中字段为psw
private String psw;
追问
@Basic(optional = false)
这个是什么意思啊?
我朋友的QQ:815479501
追答
@Basic(optional = false)
据我理解是不能为空,如果为true的话可以为空,可以试一下,和 nullable = false作用一样
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你这是在JAVA里写的,这像是一个过程!
追问
我朋友的QQ:815479501,我们有时间可以聊一下!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询