Hi i am new in nHibernate and i trying to map key to entity, when i map value to entity its work fine
Code:
<map name="Attributes" table="TERM_ATTRIBUTES">
<key column="TERM_ID"/>
<index column="VALUE" type="System.String"/>
<composite-element class="AttributeValues">
<property name="AttrName"/>
</composite-element>
</map>
but when i try to do: (i want map key as entity). Its not working
Code:
<map name="Attributes" table="TERM_ATTRIBUTES">
<key column="TERM_ID"/>
<composite-index class="AttributeValues">
<key-property name="AttrName"/>
</composite-index>
<element column="VALUE" type="System.String"/>
</map>
AttributeValues class mapping looks like:
Code:
<class name="AttributeValues" table="TERM_ATTRIBUTES" lazy="true">
<composite-id>
<key-property name="TermId" column="TERM_ID" type="long"></key-property>
<key-property name="AttrId" column="ATTR_ID" type="long"></key-property>
</composite-id>
<property name="Value" column="VALUE" />
<property name="AttrName" formula="(select attributes.name from attributes where attributes.id = ATTR_ID)" update="false" insert="false"/>
</class>
How can i map key to class AttributeValues when using map container? Thanks a lot