-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to solve this error : could not resolve property:
PostPosted: Mon Sep 22, 2008 8:55 am 
Newbie

Joined: Mon Sep 22, 2008 8:24 am
Posts: 1
Location: Bangalore
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 2:01 am 
Regular
Regular

Joined: Tue Jul 29, 2008 3:30 am
Posts: 74
1. If DOCIDPATIENTS is the primary key of the PATIENTCONTACT table, why don't you map it as id? Or is that just a mistake in your post and DOCDETAILID is the primary key? Then that would be ok, but what's the <param name="ID"/> row in your id-section there?

2. You have specified DOCID as foreign key of your relation, but above you have written that the foreign key is named DOCIDPATIENTS.

3. You have forgotten to map the column ISACTIVE.

4. Seems like you want to do a join. So why don't you just join instead of comparing the IDs in the where clause?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.