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 = PNS * result
+ (getfirstname () = = null? 0:this.getfirstname (). Hashcode ());
result = PNS * 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= "/>"
</property>
<property name= "mobile" type= "string" >
<column name= "mobile" length= "/>"
</property>
</component>
Hibernate federated Primary Key composition component (component)