📄 baseperson.java
字号:
package hibernateTest.base;
import java.io.Serializable;
/**
* This is an object that contains data related to the person table.
* Do not modify this class because it will be overwritten if the configuration file
* related to this class is modified.
*
* @hibernate.class
* table="person"
*/
public abstract class BasePerson implements Serializable {
public static String REF = "Person";
public static String PROP_SEX = "sex";
public static String PROP_ADDRESS = "address";
public static String PROP_NAME = "name";
public static String PROP_ID = "id";
// constructors
public BasePerson () {
initialize();
}
/**
* Constructor for primary key
*/
public BasePerson (int id) {
this.setId(id);
initialize();
}
/**
* Constructor for required fields
*/
public BasePerson (
int id,
java.lang.String name) {
this.setId(id);
this.setName(name);
initialize();
}
protected void initialize () {}
private int hashCode = Integer.MIN_VALUE;
// primary key
private int id;
// fields
private java.lang.String name;
private java.lang.String sex;
private java.lang.String address;
/**
* Return the unique identifier of this class
* @hibernate.id
* generator-class="increment"
* column="id"
*/
public int getId () {
return id;
}
/**
* Set the unique identifier of this class
* @param id the new ID
*/
public void setId (int id) {
this.id = id;
this.hashCode = Integer.MIN_VALUE;
}
/**
* 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;
}
/**
* 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: address
*/
public java.lang.String getAddress () {
return address;
}
/**
* Set the value related to the column: address
* @param address the address value
*/
public void setAddress (java.lang.String address) {
this.address = address;
}
public boolean equals (Object obj) {
if (null == obj) return false;
if (!(obj instanceof hibernateTest.Person)) return false;
else {
hibernateTest.Person person = (hibernateTest.Person) obj;
return (this.getId() == person.getId());
}
}
public int hashCode () {
if (Integer.MIN_VALUE == this.hashCode) {
return (int) this.getId();
}
return this.hashCode;
}
public String toString () {
return super.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -