以下pojo类表未创建
package com.cg.uas.beans;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name = "registration")
public class RegistrationBean {
@Column(name = "firstName")
private String firstName;
@Column(name = "lastName")
private String lastName;
@Column(name = "userEmail")
private String userEmail;
@Column(name = "address")
private String address;
@Column(name = "contactNo")
private long contactNo;
@Column(name = "userPassword")
private String userPassword;
//getters and setters
}
如果我为上述任何pojo类成员添加@Id注释,则表正在创建表。
答案 0 :(得分:0)
试试这个..
package com.cg.uas.beans;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name = "registration")
public class RegistrationBean {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "regId")
private long regId;
@Column(name = "firstName")
private String firstName;
@Column(name = "lastName")
private String lastName;
@Column(name = "userEmail")
private String userEmail;
@Column(name = "address")
private String address;
@Column(name = "contactNo")
private long contactNo;
@Column(name = "userPassword")
private String userPassword;
//getters and setters
}