Hi,
I'm new to NHibernate and I have two problems with my mapping.
(I'm using NHibernate 0.9.0.0)
First one:
I'm trying to map a table (many-to-one) by property-ref because
I can't use the primary key. I know that my referenced column need
unique values for this.
the many-end (
class FindObject Mapping):
Code:
<many-to-one name="objGroup" class="FindObjectGroup" column="KENNUNG" property-ref="groupID" unique="true"/>
the one-end (
class FindObjectGroup Mapping):
Code:
<property name="groupID" unique="true" column="OBJEKTKENNUNG" type="System.String" access="property"/>
<bag name="findObjects" access="property">
<key column="KENNUNG"/>
<one-to-many class="FindObject"/>
</bag>
In the rest of these mapping files shoudn't be any further mistakes. These classes are mapped from other classes as well and without the given lines my mapping works fine (There is a second mapping on FindObjectGroup which uses the composite-id of this table and - no problems).
I also tried property-ref attribut with another Class which is mapped by it's simple id primary key (which had already worked). Then I set property-ref attribut to the primary key. In result this mapping didn't work any longer.
Second Problem:
In one mapping file I have two many-to-one associations. Each refer to a separate table mapping with a composite-id. If I use only one of them the mapping is okay. But if I activate both of them my mapping crashes.
The bad thing is, I can't make any changes to the database schema
because it has been using for several years now.
If there are any ideas to my problems I would be really happy.
Thanx a lot
Uwe