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.  [ 3 posts ] 
Author Message
 Post subject: How to refer to <component> in mapping file.
PostPosted: Thu Nov 18, 2004 4:56 pm 
Beginner
Beginner

Joined: Thu Oct 14, 2004 10:53 pm
Posts: 45
I have a table called Patient. Two objects are written to Patient, they are Patient and PatientDemographics, which have their own classes Patient.java and PatientDemographics.java. There is a uni-directional reference from Patient to PatientDemographics called demographics, so I model this as follows in my mapping Patient.hbm.xml, which I believe is correct.

<class name="com.orchestral.cdr.element.Patient">

...
...
<component name="demographics" class="com.orchestral.cdr.element.PatientDemographics">
<property name="livingDependency"/>
<property name="livingArrangement"/>

<one-to-one
name="publicityCode"
class="com.orchestral.cdr.element.PatientPublicityCode"
cascade="all">
</one-to-one>
</component>

...
...
</class>

There is a bi-directional reference called publicity in PatientDemographics called PatientPublicityCode, and that information is stored in the PatientPublicityCode table. I put a one-to-one relationship in my mapping as above. This is currently my mapping in PatientPublicityCode.hbm.xml, which is probably incorrect.

<class name="com.orchestral.cdr.element.PatientPublicityCode" table="PatPublicityCode">
<many-to-one
name="patientDemographics"
class="com.orchestral.cdr.element.PatientDemographics"
column="patientFK">
</many-to-one>

My question is how does PatientPublicityCode refer back to PatientDemographics component??? Hibernate complains that PatientDemographics does not have a mapping file and I don't want to create a new mapping file for this. In my PatientPublicity class I have a reference back to patientDemographics, but I would like to refer back to that component portion in Patient.hbm.xml

Any assistance is appreciated.


[b]Hibernate version:2.1.6[/b]

[b]Mapping documents:[/b]

[b]Code between sessionFactory.openSession() and session.close():[/b]

[b]Full stack trace of any exception that occurs:[/b]

[b]Name and version of the database you are using:[/b]

[b]The generated SQL (show_sql=true):[/b]

[b]Debug level Hibernate log excerpt:[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 21, 2004 4:01 pm 
Beginner
Beginner

Joined: Thu Oct 14, 2004 10:53 pm
Posts: 45
Hi, does anyone have an answer to this one? I still cannot seem to find a solution to this. I have a component (PatientDemographics) inside a containing class (Patient). I have another object (PatientPublicityCode) that PatientDemographics refers to. I can do a <one-to-one> to PatientPublicityCode, but how do I get PatientPublicityCode to refer back to PatientDemographics??? PatientDemographics doesn't have its own mapping file, at the moment it is contained as a <component> inside the Patient mapping file.

Thanks


Top
 Profile  
 
 Post subject: Still without reply???
PostPosted: Wed Mar 07, 2007 4:46 pm 
Newbie

Joined: Fri Aug 27, 2004 9:30 am
Posts: 2
Hi all!! I'm facing the very same problem.

Does anyone have any clue on this???

Cheers,

_________________
Ivan _Fireblade_


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.