First two things I notice:
1. You mention Property set has a composite primary key but this is not
shown in the mapping.
2. Why use a composite key on PropertyValue when you have a possible unique
Value_ID column.
I am missing what you are trying to accomplish here. Is the following class
similar to yours?
class PropertySet
{
int ID;
string Name;
ICollection<Property> Properties;
}
On Thu, Jul 14, 2011 at 1:12 AM, Sascha Killinger <
[email protected]> wrote:
> Hello group,
>
> I would like to map the following tables:
>
> Property
> ------------------
> ID (PK)
> Name
>
>
> PropertyValue
> ------------------
> Property_ID (PK)
> Value_ID (PK)
> Value
>
> FK(Property_ID) references Property
>
>
> PropertySet
> ------------------
> ID(PK)
> Name
>
>
> PropertySet_Properties
> ------------------
> PropertySet_ID (PK)
> Property_ID (PK)
> Value_ID
>
> FK(PropertySet_ID) references PropertySet
> FK(Property_ID, Value_ID) references PropertyValue
>
>
> I tried the following:
>
> <class name="Property">
> <id name="ID">
> <generator class="native" />
> </id>
> <property name="Name" />
> <set name="Values" inverse="true">
> <key column="Property_ID"/>
> <one-to-many class="PropertyValue"/>
> </set>
> </class>
>
> <class name="PropertyValue">
> <composite-id>
> <key-many-to-one class="Property" name="Property"
> column="Property_ID" />
> <key-property name="ID" />
> </composite-id>
> <property name="Value" />
> </class>
>
>
> <class name="PropertySet">
> <id name="ID">
> <generator class="native" />
> </id>
> <property name="Name" />
> <map name="Properties" table="PropertySet_Properties">
> <key column="PropertySet_ID" />
> <index-many-to-many column="Property_ID" class="Property" />
> <many-to-many class="PropertyValue">
> <column name="Value_ID"></column>
> <column name="Property_ID"></column>
> </many-to-many>
> </map>
> </class>
>
> But NHibernate does not accept the duplicate column Property_ID. Ist
> there any better way to map?
>
> Any help or advice is greatly appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
Ramon
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.