Joined: Mon May 25, 2009 6:07 am Posts: 4 Location: Pune, India
|
I have Two tables Table A and Table B with a many is to one relation. There are no explicitly defined constraints between the tables.
A.cMake & A.cModel holds the value of B.make and B.model respectively. I'm trying to create a mapping file A.hbm.xml, such that A.getB() returns a Set (or Map?).
<hibernate-mapping>
<id name="isn" type="integer"> <column name="ISN" /> <generator class="assigned"></generator> </id>
<property name="cMake" type="short" > <column name="CMAKE" /> </property>
<property name="cModel" type="short" > <column name="CMODEL" /> </property>
<set name="bSet" fetch="???" table="B"> <key> <column name="MAKE" /> <column name="MODEL" /> </key> <one-to-many class="B"></one-to-many> </set>
</hibernate-mapping>
How will I correlate the properties cMake and cModel to the MAKE and MODEL columns?
Is there any better way to getB()?
I was trying to find some way in which I can do this in .hbm.xml rather than do a saved query.
thanks for any help.
|
|