Uploaded image for project: 'NHibernate'
  1. NH-1722

property-ref for columns in a composite key


    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0.Alpha1
    • Fix Version/s: None
    • Component/s: Core


      if you map a relation or collection you can use the property-ref attribute to make NHibernate work with legacy data. That's very useful and works as it shoudl. But in my current project nearly all tables have composite ids and relations also use them. As far as I know it is not possible to use the property-ref attribute on the columns of those composite ids. So many relations in this legacy database can't be mapped by NHibernate due to the lack of this functionality...

      I would really appreciate the possiblity of telling NHibernate to take the property-ref attribute in composite ids...

      The mapping for that could be like the following I think:

      <bag name="MyCollection" table="COLL" cascade="none" inverse="true">
      		<column name="CUSTOM_COL" property-ref="CustomColumn" />
      		<column name="ID2" />
      	<one-to-many class="MyCollection" />

      For this example you can imagine that the table holding that collection has a few columns (e.g. CUSTOM_COL) and the composite id with the columns ID1 and ID2. The table COLL has the composite id of CUSTOM_COL and ID2...

      I know many projects that have such a legacy structure and it would be very nice if you could add the described functionality to support those projects...





            • Assignee:
              typhos Manuel Rennecke
            • Votes:
              17 Vote for this issue
              12 Start watching this issue


              • Created:

                Who's Looking?