मेरा कोड निम्नलिखित है मैं डेटाबेस से डेटा लाने के लिए कई सूचियों का उपयोग कर रहा हूं। एचक्यूएल क्वेरी से डेटा लाने पर यह अपवाद दिखा रहा है।org.hibernate.loader.MultipleBagFetchException: एक साथ कई बैग नहीं ला सकता
Pojo कक्षा
public class BillDetails implements java.io.Serializable {
private Long billNo;
// other fields
@LazyCollection(LazyCollectionOption.FALSE)
private List<BillPaidDetails> billPaidDetailses = new ArrayList<BillPaidDetails>();
private Set productReplacements = new HashSet(0);
@LazyCollection(LazyCollectionOption.FALSE)
private List<BillProduct> billProductList = new ArrayList<BillProduct>();
//getter and setter
}
hmb.xml फ़ाइल
<class name="iland.hbm.BillDetails" table="bill_details" catalog="retail_shop">
<id name="billNo" type="java.lang.Long">
<column name="bill_no" />
<generator class="identity" />
</id>
<bag name="billProductList" table="bill_product" inverse="true" lazy="false" fetch="join">
<key>
<column name="bill_no" not-null="true" />
</key>
<one-to-many class="iland.hbm.BillProduct" />
</bag>
<bag name="billPaidDetailses" table="bill_paid_details" inverse="true" lazy="false" fetch="select">
<key>
<column name="bill_no" not-null="true" />
</key>
<one-to-many class="iland.hbm.BillPaidDetails" />
</bag>
<set name="productReplacements" table="product_replacement" inverse="true" lazy="false" fetch="join">
<key>
<column name="bill_no" not-null="true" />
</key>
<one-to-many class="iland.hbm.ProductReplacement" />
</set>
</class>
HQL क्वेरी
String hql = "select distinct bd,sum(bpds.amount) from BillDetails as bd "
+ "left join fetch bd.customerDetails as cd "
+ "left join fetch bd.billProductList as bpd "
+ "left join fetch bpd.product as pd "
+"left join fetch bd.billPaidDetailses as bpds "
+ "where bd.billNo=:id "
+ "and bd.client.id=:cid ";
मैं क्वेरी निम्नलिखित डेटाबेस से डेटा लाने कोशिश कर रहा हूँ, लेकिन यह org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
दिखा रहा है कैसे हल करें ई
आप सेट करने के लिए अपने सूचियाँ बदल रहा करने की कोशिश की है? – JamesB
यह आलेख आपकी मदद कर सकता है: http://blog.eyallupu.com/2010/06/hibernate-exception-simultaneously.html – JamesB
बिल प्रोडक्ट पर अद्वितीय आईडी प्रॉपर्टी का नाम क्या है? – JamesB