@Transient问题
为什么不能在数据库表jpa反向工程的类中增加@Transient,增加之后会报错,代码如下:
package entities;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
* Student entity.
*
* @author MyEclipse Persistence Tools
*/
@Entity
@Table(name = "STUDENT", schema = "YKMES", uniqueConstraints = {})
public class Student implements java.io.Serializable {
// Fields
private Long id;
private String stuNo;
private String stuName;
private String homePhone;
private String familyAddr;
// Constructors
/** default constructor */
public Student() {
}
/** minimal constructor */
public Student(Long id) {
this.id = id;
}
/** full constructor */
public Student(Long id, String stuNo, String stuName, String homePhone,
String familyAddr) {
this.id = id;
this.stuNo = stuNo;
this.stuName = stuName;
this.homePhone = homePhone;
this.familyAddr = familyAddr;
}
// Property accessors
@Id
@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, precision = 22, scale = 0)
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name = "STU_NO", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
public String getStuNo() {
return this.stuNo;
}
public void setStuNo(String stuNo) {
this.stuNo = stuNo;
}
@Column(name = "STU_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
public String getStuName() {
return this.stuName;
}
public void setStuName(String stuName) {
this.stuName = stuName;
}
@Column(name = "HOME_PHONE", unique = false, nullable = true, insertable = true, updatable = true, length = 11)
public String getHomePhone() {
return this.homePhone;
}
public void setHomePhone(String homePhone) {
this.homePhone = homePhone;
}
@Column(name = "FAMILY_ADDR", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getFamilyAddr() {
return this.familyAddr;
}
public void setFamilyAddr(String familyAddr) {
this.familyAddr = familyAddr;
}
@Transient
private String x;
}
@Entity报:entity does not have a id
其他字段报:the column xxxxx can not be found on table STUDENT.
为啥啊,请高手指点!!!!!!!!!