0
我正在使用struts2和hibernate。當我在我的程序中實現一對多映射時遇到問題。我從jsp獲得了列表的空值。請幫幫我有代碼:當我在休眠狀態下使用列表映射一對多映射時,我得到了空值
父POJO類是:`
private static final long serialVersionUID = 1L;
private int id;
private String voucherno;
private String vendor_name;
private String address;
private Integer vendor_invoice_no;
private Date invoice_date;
private Date due_date;
private Date user_date;
private String currency;
private Double exRate;
private Double totalAmt;
private Double totalSTex;
private Double tds_amount;
private Double s_tax_amount;
private String tds_section;
private Double tds_cost;
private Double tdsamount;
private Double payable_amount;
private String narration;
private List<Payable_datail> recievable_detail ;
孩子POJO類是:
private Integer payable_Id;
private String chargeHead;
private String description;
private Double amount;
private Double tamount;
private String st_chargehead;
private String s_tax_list;
private String service_tax_category;
private Double s_tax;
private Double edu_case;
private Double high_case;
private Double total_s_tax;
private Payable_detaildto payable_detailDto;
父HBM文件是:
<list name="recievable_detail" inverse="false" lazy="true" cascade="all">
<key column="ID" ></key>
<index column="index"></index>
<one-to-many class="com.envosys.dto.Payable_datail"/>
</list>
兒童HBM文件是:
<many-to-one name="payable_detailDto" class="com.envosys.dto.Payable_detaildto" fetch="join" unique="false" update="true" insert="true" optimistic-lock="true" not-found="exception" embed-xml="true">
<column name="ID" />
</many-to-one>
和jsp就是我使用這個列表「recievable_detail」:是
cell0.innerHTML = "<td align='left'><input id='chargeHead"+count+"' name='recievable_detail["+count+"].chargeHead' type='text' value='"+chargehead+"' class='text ui-widget-content ui-corner-all chargeHead' size=50 ' onblur=\"check("+count+")\" ><input type =\"hidden\" id='set_service"+count+"' name = \"set_service\"> ";
cell1.innerHTML = "<td align='left'><textarea id='description"+count+"' name='recievable_detail["+count+"].description' type='textarea' rows=\"1\" cols=\"30\" class='text ui-widget-content ui-corner-all'> ";
cell2.innerHTML = "<td align='left'><input id='amount"+count+"' name='recievable_detail["+count+"].amount' type='text' value="+amount+" class='text ui-widget-content ui-corner-all' onkeyup='data1()'> ";
cell3.innerHTML = "<td align='left'><input id='tamount"+count+"' name='recievable_detail["+count+"].tamount' type='text' value="+tamount+" class='text ui-widget-content ui-corner-all'> ";
cell4.innerHTML = "<a onclick=\"removeRow("+count+")\" align=\"center\"><img src=\"images/Minus.png\"/></a></td>";
我的問題是,我無法子類和父類之間進行映射,因爲我得到了名單的價值「recievable_detail」爲空在父類的getter和setter中。請幫助我,給我任何想法和適當的建議給我。
`