PO类public class PartUser { private int hashCode = Integer.MIN_VALUE; // primary key
private java.lang.Integer _rid; // fields
private java.lang.Integer _part_rid;
private java.lang.Integer _user_rid;
private java.lang.String _re;
// constructors
public BasePartUser () {} /**
 * Constructor for primary key
 */
public BasePartUser (java.lang.Integer _rid) {
this.setRid(_rid);
} /**
 * Return the unique identifier of this class
     * @hibernate.id
     *  generator-class="sequence"
     *  column="rid"
     */
public java.lang.Integer getRid () {
return _rid;
} /**
 * Set the unique identifier of this class
 * @param _rid the new ID
 */
public void setRid (java.lang.Integer _rid) {
this._rid = _rid;
this.hashCode = Integer.MIN_VALUE;
}
/**
 * Return the value associated with the column: part_rid
 */
public java.lang.Integer getPart_rid () {
return _part_rid;
} /**
 * Set the value related to the column: part_rid
 * @param _part_rid the part_rid value
 */
public void setPart_rid (java.lang.Integer _part_rid) {
this._part_rid = _part_rid;
}
/**
 * Return the value associated with the column: user_rid
 */
public java.lang.Integer getUser_rid () {
return _user_rid;
} /**
 * Set the value related to the column: user_rid
 * @param _user_rid the user_rid value
 */
public void setUser_rid (java.lang.Integer _user_rid) {
this._user_rid = _user_rid;
}
/**
 * Return the value associated with the column: re
 */
public java.lang.String getRe () {
return _re;
} /**
 * Set the value related to the column: re
 * @param _re the re value
 */
public void setRe (java.lang.String _re) {
this._re = _re;
}
public boolean equals (Object obj) {
if (null == obj) return false;
if (!(obj instanceof com.mole.hbws.xtgl.entity.base.BasePartUser)) return false;
else {
com.mole.hbws.xtgl.entity.base.BasePartUser mObj = (com.mole.hbws.xtgl.entity.base.BasePartUser) obj;
if (null == this.getRid() || null == mObj.getRid()) return false;
else return (this.getRid().equals(mObj.getRid()));
}
}
public int hashCode () {
if (Integer.MIN_VALUE == this.hashCode) {
if (null == this.getRid()) return super.hashCode();
else {
String hashStr = this.getClass().getName() + ":" + this.getRid().hashCode();
this.hashCode = hashStr.hashCode();
}
}
return this.hashCode;
}
public String toString () {
return super.toString();
}}hbm.xml 配置文件<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping package="com.mole.hbws.xtgl.entity">
<class name="PartUser" table="XT_PART_USER">
<id name="rid" column="rid" type="integer" >
<generator class="native"/>
</id>
<property name="part_rid" column="part_rid" type="integer" />
<property name="user_rid" column="user_rid" type="integer" />
<property name="re" column="re" type="string" />
</class>
</hibernate-mapping>
出现错误
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]无法将 NULL 值插入列 'RID',表 'hbggws.dbo.XT_PART_USER';该列不允许空值。INSERT 失败。