Hi all,
I am getting following error on my project. please help me how do solve that.
could not resolve property: DOCIDPATIENTS of: MagnumCore.PatientContact [from MagnumCore.Patient as pat,pat.PatientContact as
PatCon where pat.DOCNum= '700990' and PatCon.DOCIDPATIENTS=pat.DOCID and PatCon.ISACTIVE='T']
Details about my task:
I have two table called Patient(Parent table) and PatientContact(Child table).
Patient(Parent) table columns
DOCID(primarykey) Varchar
DOCNum varchar
PATIENTFIRSTNAME varchar
PatientContact(Child) table columns
DOCIDPATIENTS(primarykey) varchar
DOCDETAILID(Forignkey) varchar
ISACTIVE varchar
Mapping files :
Patient Mapping code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="MagnumCore.Patient, MagnumCore" table="PATIENT" lazy="false">
<id name="DocId" column="DOCID" unsaved-value="0">
<generator class="MagnumCore.CustomCollections.GenerateID, MagnumCore" >
<!--<param name="ID"/>-->
</generator>
<!--<generator class="assigned" />-->
</id>
<property name="DocNum" column="DOCNUM" />
<bag name="PatientContact" inverse="true" lazy="false" cascade="all-delete-orphan"
collection-type="MagnumCore.CustomCollections.ObservableList`1[[MagnumCore.PatientContact, MagnumCore]], MagnumCore">
<key column="DOCIDPATIENTS" />
<one-to-many class="MagnumCore.PatientContact, MagnumCore"/>
</bag>
</class>
</hibernate-mapping>
PatientContact Mapping code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="MagnumCore.PatientContact, MagnumCore" table="PATIENTCONTACT" lazy="false">
<id name="DocDetailID" column="DOCDETAILID" unsaved-value="0">
<!--<generator class="assigned" />-->
<generator class="MagnumCore.CustomCollections.GenerateID, MagnumCore" >
<param name="ID"/>
</generator>
</id>
<many-to-one name="Patient" class="MagnumCore.Patient, MagnumCore" column="DOCID" />
</class>
</hibernate-mapping>
PatientRepository.cs
IQuery query = session.CreateQuery("from Patient as pat,pat.PatientContact as PatCon where pat.DocNum= '111' and
PatCon.DocDetailID=pat.DocId and PatCon.IsActive='T'");
IList<Patient> patients = query.List<Patient>();
Patient patient = patients.First();
return patient;
Here only i am getting those error.
please help how to solve that.
and how to write join query with multiple condition in child table.
Please reply me as soon as possible.
with love,
_________________ I am very new this forum. I like to share my knowledge and getting idea to/from this forum.
|