当前位置: 代码迷 >> JBoss >> 求ejb基础解决思路
  详细解决方案

求ejb基础解决思路

热度:1178   发布时间:2013-02-26 00:00:00.0
求ejb基础
由于本人初学,问题很脑残,请不要笑话啊
@Entity
@Table(name="t_user")
public class UserEntity implements Serializable {

private int u_id;

private String u_name;

private String u_IDcard;

private String u_phone;

private Date u_etime;

private Date u_otime;

private double u_discount;

private Set house=new HashSet();

@Column() public double getU_discount() {
return u_discount;
}

public void setU_discount(double u_discount) {
this.u_discount = u_discount;
}

@Column() public Date getU_etime() {
return u_etime;
}

public void setU_etime(Date u_etime) {
this.u_etime = u_etime;
}

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
public int getU_id() {
return u_id;
}

public void setU_id(int u_id) {
this.u_id = u_id;
}

@Column(nullable=false,length=20)
public String getU_IDcard() {
return u_IDcard;
}

public void setU_IDcard(String dcard) {
u_IDcard = dcard;
}

@Column(nullable=false,length=20)
public String getU_name() {
return u_name;
}

public void setU_name(String u_name) {
this.u_name = u_name;
}

@Column() public Date getU_otime() {
return u_otime;
}

public void setU_otime(Date u_otime) {
this.u_otime = u_otime;
}

@Column(nullable=false,length=20)
public String getU_phone() {
return u_phone;
}

public void setU_phone(String u_phone) {
this.u_phone = u_phone;
}

@OneToMany(mappedBy="user",cascade=CascadeType.REFRESH,fetch=FetchType.EAGER,targetEntity=HouseEntity.class)
@JoinColumn(name="h_id")
public Set getHouse() {
return house;
}

public void setHouse(Set house) {
this.house = house;
}



}
请问时间,Double类型的怎么写@column()啊[color=#FF0000][/color]

------解决方案--------------------------------------------------------
Double类型的一般数据库字段都要求可以为空,并且Double长度是固定的啊!没有必要限制长度。
所以直接就写成@Column()了,其实应该把name属性加上的
@Column(name = "字段名") 
public double getU_discount() {
return u_discount;
}
  相关解决方案