Hi,
I have a rather ugly legacy data model to map.
The entity model should look like this:
public class Parent
{
public string Name {get;set;};
public virtual ICollection<Child> {get;set;}
}
public class Child
{
public string SomeProp {get;set;}
...
}
And the legacy data model looks like this:
Parent
(
PK ParentName nvarchar(10),
PK FK ChildId uniqueidentifier
)
Child
(
PK ChildId uniqueidentifier,
SomeProp nvarchar(50),
...
)
And here is my mapping:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="IntegrationTests, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" namespace="IntegrationTests.Domain">
<class name="Parent" table="Parent" xmlns="urn:nhibernate-
mapping-2.2" lazy="false">
<id name="Name" type="String" column="Name">
<generator class="assigned" />
</id>
</class>
</hibernate-mapping>
The problem here is that when I query for Parents, I get duplicates,
because table Parent has multiple rows per Parent entity (one per
Child entity). I don't make composite-id because from the domain
perspective Parent's Name distinguishes entities unambiguously.
Is there any way in NH to map it correctly?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---