67,512
社区成员
发帖
与我相关
我的任务
分享
public class Charge {
private int charge_id;
private String charge_content;
private Long charge_price;
private Date charge_date;
private Boolean charge_status;
private Set chargeobj = new HashSet(0);
get/set我就没写
Charge.hbm.xml:
<hibernate-mapping>
<class name="com.wwq.entity.Charge" table="charge_list">
<id name="charge_id" column="CHARGE_ID" type="int">
<generator class="native"></generator>
</id>
<property name="charge_content" column="CHARGE_CONTENT" type="string"></property>
<property name="charge_price" column="CHARGE_PRICE" type="long"></property>
<property name="charge_date" column="CHARGE_DATE" type="date"></property>
<property name="charge_status" column="CHARGE_STATUS" type="boolean"></property>
<set name="chargeobj" inverse="true">
<key>
<column name="charge_id" />
</key>
<one-to-many class="com.wwq.entity.Charge"/>
</set>
</class>
</hibernate-mapping>
public class ChargeObj {
private int chargeobj_id;
private String chargeobj_user;
private Charge charge;
ChargeObj.hbm.xml:
<hibernate-mapping>
<class name="com.wwq.entity.ChargeObj" table="charge_obj">
<id name="chargeobj_id" column="CHARGEOBJ_ID" type="int">
<generator class="native"></generator>
</id>
<many-to-one name="charge" class="com.wwq.entity.Charge" fetch="select">
<column name="CHARGE_ID" />
</many-to-one>
<property name="chargeobj_user" column="CHARGEOBJ_USER" type="string"></property>
</class>
</hibernate-mapping>
<table>
<tr>
<th>缴费内容</th>
<th>缴费金额</th>
<th>缴费时间</th>
<th>缴费状态</th>
<th>需缴费者</th>
<th>缴费操作</th>
</tr>
<s:iterator value="#request.charlist" var="charlist">
<tr>
<td>${charlist.chargeobj_user}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</s:iterator>
</table>
public class ChargeAction extends ActionSupport{
private static final long serialVersionUID = 1L;
private Charge charge;
public Charge getCharge() {
return charge;
}
public void setCharge(Charge charge) {
this.charge = charge;
}
public String findAllList(){
ChargeService charService = new ChargeService();
List<Charge> list = charService.findAllList();
ActionContext.getContext().put("charlist", list);
return SUCCESS;
}
}