枚举问题
枚举类
package bbshoping.jian.oa;
public enum Sex {
NONE{public String getName(){return "男女不限";} },
MAN{public String getName(){return "男";} },
WOMEN{public String getName(){return "女";}};
public abstract String getName();
}
实体类的一部分
package bbshoping.jian.oa;
public class ProductInfo {
private Integer id;
public ProductInfo() {
}
public ProductInfo(Integer id) {
this.id = id;
}
private Sex sexrequest = Sex.NONE;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Sex getSexrequest() {
return sexrequest;
}
public void setSexrequest(Sex sexrequest) {
this.sexrequest = sexrequest;
}
}
ProductInfo.hbm.xml中的配制
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class table="T_ProductInfo" name="bbshoping.jian.oa.ProductInfo" >
<id name="id">
<generator class="native"/>
</id>
<property name="sexrequest" </property>
</class>
</hibernate-mapping>
sexrequest数据加不进,请问如何在ProductInfo.hbm.xml中配制sexrequest 属性,