java - "The collection was unreferenced" .Hibernate filter on an entity list by a column name? -
java - "The collection was unreferenced" .Hibernate filter on an entity list by a column name? -
im getting prescription list mysql db , want , filter list patient_id , filtered list.
i'm getting prescriptions list finely.but i'm unable filterlist. next code.
@override @transactional public list<prescription> retrieveallprescriptionsbypatientid(int id) { session session=sessionfactory.getcurrentsession(); list<prescription>prescriptions = session.createcriteria(prescription.class).list() ; @suppresswarnings("unchecked") list<prescription> filterlist =(list<prescription>) session.createfilter(prescriptions, "where patient_id = :id").setinteger("id", id).list(); homecoming (list<prescription>)filterlist; }
this exception i'm getting.
exception in thread "main" org.hibernate.queryexception: collection unreferenced @ org.hibernate.internal.sessionimpl.getfilterqueryplan(sessionimpl.java:1483) @ org.hibernate.internal.sessionimpl.createfilter(sessionimpl.java:1330) @ com.tela.pms.dao.impl.prescriptiondaoimpl.retrieveallprescriptionsbypatientid(prescriptiondaoimpl.java:63) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.springframework.aop.support.aoputils.invokejoinpointusingreflection(aoputils.java:318) @ org.springframework.aop.framework.reflectivemethodinvocation.invokejoinpoint(reflectivemethodinvocation.java:183) @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:150) @ org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:110) @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:172) @ org.springframework.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:202) @ com.sun.proxy.$proxy19.retrieveallprescriptionsbypatientid(unknown source) @ com.tela.pms.service.impl.prescriptionserviceimpl.retrieveallprescriptionsbypatientid(prescriptionserviceimpl.java:47) @ com.tela.pms.test.hibernatetester.main(hibernatetester.java:45)
please help me out this. thanks
java mysql hibernate hibernate-mapping query-expressions
Comments
Post a Comment