模型
Java代碼
package Domain;
import java
public class User {
public int getId() {
return id;
}
public void setId(int id) {
this
}
public Name getName() {
return name;
}
public void setName(Name name) {
this
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this
}
private int id;
// private String name;
private Name name;
private Date birthday;
}
Java代碼
package Domain;
public class Name {
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this
}
private String firstName;
private String lastName;
}
Java代碼
<?xml version=
<!DOCTYPE hibernate
<hibernate
<class name=
<id name=
<generator class=
</id>
<!
<property name=
<component name=
<property name=
<property name=
</component>
<property name=
</class>
</hibernate
Java代碼
package Dao
import java
import Dao
import Dao
import Domain
import Domain
public class UserDAOTest {
public static void main(String[] args) {
/*UserDAO dao = new UserDAOImpl();
User user = new User();
user
user
System
dao
System
user
dao
System
User u = dao
System
dao
User user = new User();
user
Name n = new Name();
n
n
user
UserDAO dao = new UserDAOImpl();
dao
}
}
From:http://tw.wingwit.com/Article/program/Java/ky/201311/27927.html