hibernate的问题
实体:
public class Party {
private Integer id;
private PartyType type;// 类型 many-to-one
private boolean status;
private Party parent;// 父节点
private Set<Party> children = new HashSet<Party>();// 子节点
private Timestamp formTime;// 起始时间
private Timestamp thruTime;// 过期时间
private String note;
private User user;
private UserInformation userInformation;
private Set<Order> orders;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public PartyType getType() {
return type;
}
public void setType(PartyType type) {
this.type = type;
}
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public Party getParent() {
return parent;
}
public void setParent(Party parent) {
this.parent = parent;
}
public Set<Party> getChildren() {
return children;
}
public void setChildren(Set<Party> children) {
this.children = children;
}
public Timestamp getFormTime() {
return formTime;
}
public void setFormTime(Timestamp formTime) {
this.formTime = formTime;
}
public Timestamp getThruTime() {
return thruTime;
}
public void setThruTime(Timestamp thruTime) {
this.thruTime = thruTime;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public UserInformation getUserInformation() {
return userInformation;
}
public void setUserInformation(UserInformation userInformation) {
this.userInformation = userInformation;
}
public Set<Order> getOrders() {
return orders;
}
public void setOrders(Set<Order> orders) {
this.orders = orders;
}
}
映射文件
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.flight.domain">
<class name="Party" table="party">
<id name="id" type="integer" column="pid">
<generator class="native" />
</id>
<property name="status" type="java.lang.Boolean">
<column name="status" not-null="true" />
</property>
<property name="formTime" type="timestamp">
<column name="formTime" not-null="true" />
</property>
<property name="thruTime" type="timestamp">
<column name="thruTime" not-null="true" />
</property>
<property name="note" type="string">
<column name="note" not-null="true" length="200"/>
</property>
<one-to-one name="user" class="User" cascade="all" ></one-to-one>
<one-to-one name="userInformation" class="UserInformation" cascade="all"></one-to-one>
<many-to-one name="parent" column="parentId"/>
<set name="children" lazy="false">
<key column="parentId"/>
<one-to-many class="Party"/>
</set>
<many-to-one name="type" class="PartyType" column="ptid" cascade="save-update" lazy="false"/>
<set name="orders" lazy="extra" inverse="true">
<key column="pid"/>
<one-to-many class="Order"/>
</set>
</class>
</hibernate-mapping>
现在要设计业务方法,取出一个节点的所有子节点。各位大侠请指教