www.pudn.com > PetTest.rar > BasePet.java


package bo.base; 
 
import java.io.Serializable; 
 
 
/** 
 * This class has been automatically generated by Hibernate Synchronizer.
 * For more information or documentation, visit The Hibernate Synchronizer page
 * at http://www.binamics.com/hibernatesync or contact Joe Hudson at joe@binamics.com.
 *
 * This is an object that contains data related to the pet table. 
 * Do not modify this class because it will be overwritten if the configuration file 
 * related to this class is modified. 
 * 
 * @hibernate.class 
 *  table="pet" 
 */ 
public abstract class BasePet  implements Serializable { 
 
	public static String PROP_TYPE = "Type"; 
	public static String PROP_SEX = "Sex"; 
	public static String PROP_PETID = "Petid"; 
	public static String PROP_OWNERID = "Ownerid"; 
	public static String PROP_NAME = "Name"; 
	public static String PROP_AGE = "Age"; 
 
 
	private int hashCode = Integer.MIN_VALUE; 
 
	// primary key 
	private java.lang.Integer _petid; 
 
	// fields 
	private java.lang.String _sex; 
	private java.lang.Integer _age; 
	private java.lang.String _type; 
	private java.lang.String _name; 
 
	// many to one 
	private bo.Owner _ownerid; 
 
 
	// constructors 
	public BasePet () { 
		initialize(); 
	} 
 
	/** 
	 * Constructor for primary key 
	 */ 
	public BasePet (java.lang.Integer _petid) { 
		this.setPetid(_petid); 
		initialize(); 
	} 
 
	/** 
	 * Constructor for required fields 
	 */ 
	public BasePet ( 
		java.lang.Integer _petid, 
		bo.Owner _ownerid) { 
 
		this.setPetid(_petid); 
		this.setOwnerid(_ownerid); 
		initialize(); 
	} 
 
	protected void initialize () {} 
 
 
 
	/** 
	 * Return the unique identifier of this class 
     * @hibernate.id 
     *  generator-class="vm" 
     *  column="petid" 
     */ 
	public java.lang.Integer getPetid () { 
		return _petid; 
	} 
 
	/** 
	 * Set the unique identifier of this class 
	 * @param _petid the new ID 
	 */ 
	public void setPetid (java.lang.Integer _petid) { 
		this._petid = _petid; 
		this.hashCode = Integer.MIN_VALUE; 
	} 
 
 
	/** 
	 * Return the value associated with the column: sex 
	 */ 
	public java.lang.String getSex () { 
		return _sex; 
	} 
 
	/** 
	 * Set the value related to the column: sex 
	 * @param _sex the sex value 
	 */ 
	public void setSex (java.lang.String _sex) { 
		this._sex = _sex; 
	} 
 
 
	/** 
	 * Return the value associated with the column: age 
	 */ 
	public java.lang.Integer getAge () { 
		return _age; 
	} 
 
	/** 
	 * Set the value related to the column: age 
	 * @param _age the age value 
	 */ 
	public void setAge (java.lang.Integer _age) { 
		this._age = _age; 
	} 
 
 
	/** 
	 * Return the value associated with the column: type 
	 */ 
	public java.lang.String getType () { 
		return _type; 
	} 
 
	/** 
	 * Set the value related to the column: type 
	 * @param _type the type value 
	 */ 
	public void setType (java.lang.String _type) { 
		this._type = _type; 
	} 
 
 
	/** 
	 * Return the value associated with the column: name 
	 */ 
	public java.lang.String getName () { 
		return _name; 
	} 
 
	/** 
	 * Set the value related to the column: name 
	 * @param _name the name value 
	 */ 
	public void setName (java.lang.String _name) { 
		this._name = _name; 
	} 
 
 
	/** 
     * @hibernate.property 
     *  column=ownerid 
	 * not-null=true 
	 */ 
	public bo.Owner getOwnerid () { 
		return this._ownerid; 
	} 
 
	/** 
	 * Set the value related to the column: ownerid 
	 * @param _ownerid the ownerid value 
	 */ 
	public void setOwnerid (bo.Owner _ownerid) { 
		this._ownerid = _ownerid; 
	} 
 
 
	public boolean equals (Object obj) { 
		if (null == obj) return false; 
		if (!(obj instanceof bo.base.BasePet)) return false; 
		else { 
			bo.base.BasePet mObj = (bo.base.BasePet) obj; 
			if (null == this.getPetid() || null == mObj.getPetid()) return false; 
			else return (this.getPetid().equals(mObj.getPetid())); 
		} 
	} 
 
 
	public int hashCode () { 
		if (Integer.MIN_VALUE == this.hashCode) { 
			if (null == this.getPetid()) return super.hashCode(); 
			else { 
				String hashStr = this.getClass().getName() + ":" + this.getPetid().hashCode(); 
				this.hashCode = hashStr.hashCode(); 
			} 
		} 
		return this.hashCode; 
	} 
 
 
	public String toString () {
		return super.toString();
	} 
 
}