से जुड़ा नहीं है मेरे एक दोस्त को ओपन सोर्स सॉफ्टवेयर OscarMcmaster
में एक अनोखी समस्या मिली है। उसने मुझे मदद करने के लिए कहा और मैं समस्या के कारण कोड प्राप्त करने में सक्षम हूं।org.hibernate.HibernateException: संग्रह किसी भी सत्र
public BillingService getBillingCodeByCode(String code){
List list = billingServiceDao.findBillingCodesByCode(code,"BC");
if(list == null || list.size() ==0){
return null;
}
return (BillingService) list.get(0);
}
billingServiceDao
Spring
कंटेनर से आरंभ नहीं हो जाता:
private static BillingServiceDao billingServiceDao =
(BillingServiceDao) SpringUtils.getBean("billingServiceDao");
BillingServiceDao
में वर्ग निम्न कोड निष्पादित:
public List<BillingService> findBillingCodesByCode(String code, String region) {
Query query = entityManager.createQuery("select bs from....");
query.setParameter("code", code + "%");
query.setParameter("region", region);
@SuppressWarnings("unchecked")
List<BillingService> list = query.getResultList();
return list;
}
अपराधी query.getResultList();
है, लेकिन मैं निम्नलिखित एक विधि है अन्य ब्रह्मांड से (नेट) और समस्या के लिए उपाय नहीं पता।
कृपया मेरी समस्या को हल करने में मेरी मदद करें।
संपादित करें: - स्टैक ट्रेस
SEVERE: Servlet.service() for servlet action threw exception
org.hibernate.HibernateException: collection is not associated with any session
at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:449)
at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:797)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:241)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:66)
at org.oscarehr.common.dao.BillingServiceDao.findBillingCodesByCode(BillingServiceDao.java:47)
at org.oscarehr.common.dao.BillingServiceDao$$FastClassByCGLIB$$f613fb7e.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
इस लिंक से आपको मदद मिल सकती है: http://stackoverflow.com/questions/8292820/org-hibernate-lazyinitialization-exception –