标签:
package db.domain;
/**
* PersonId entity. @author MyEclipse Persistence Tools
*/
public class PersonId implements java.io.Serializable {
// Fields
private String firstname;
private String lastname;
// Constructors
/** default constructor */
public PersonId() {
}
/** full constructor */
public PersonId(String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
}
// Property accessors
public String getFirstname() {
return this.firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return this.lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof PersonId))
return false;
PersonId castOther = (PersonId) other;
return ((this.getFirstname() == castOther.getFirstname()) || (this
.getFirstname() != null
&& castOther.getFirstname() != null && this.getFirstname()
.equals(castOther.getFirstname())))
&& ((this.getLastname() == castOther.getLastname()) || (this
.getLastname() != null
&& castOther.getLastname() != null && this
.getLastname().equals(castOther.getLastname())));
}
public int hashCode() {
int result = 17;
result = 37 * result
+ (getFirstname() == null ? 0 : this.getFirstname().hashCode());
result = 37 * result
+ (getLastname() == null ? 0 : this.getLastname().hashCode());
return result;
}
}
package db.domain;
/**
* Person entity. @author MyEclipse Persistence Tools
*/
public class Person implements java.io.Serializable {
// Fields
private PersonId id;
private String sex;
private Integer age;
private String birth;
// Constructors
/** default constructor */
public Person() {
}
/** minimal constructor */
public Person(PersonId id) {
this.id = id;
}
/** full constructor */
public Person(PersonId id, String sex, Integer age, String birth) {
this.id = id;
this.sex = sex;
this.age = age;
this.birth = birth;
}
// Property accessors
public PersonId getId() {
return this.id;
}
public void setId(PersonId id) {
this.id = id;
}
public String getSex() {
return this.sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Integer getAge() {
return this.age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getBirth() {
return this.birth;
}
public void setBirth(String birth) {
this.birth = birth;
}
}
<component name="address" class="Address">
<property name="postalCode" type="string">
<column name="postalCode" length="20" />
</property>
<property name="mobile" type="string">
<column name="mobile" length="20" />
</property>
</component>
标签:
原文地址:http://www.cnblogs.com/hzzhero/p/5134792.html