But component mapping cannot implement lazy load. Any ways to get both 
single table one-to-one mapping and lazy load?


Jeffrey Zhao
Blog: http://www.cnblogs.com/JeffreyZhao/
Twitter: http://twitter.com/jeffz_cn

--------------------------------------------------
From: "hival" <[email protected]>
Sent: Monday, August 10, 2009 4:36 PM
To: "nhusers" <[email protected]>
Subject: [nhusers] Re: Mapping one-to-one relationship in a single table

>
> To use associations your table should contain a foreign key. In your
> current table definition you should use component, and the mapping
> like this:
>
> <class name="Product" table="Product">
>        <id name="ProductID" column="ProductID">
>           <generator class="hilo"/>
>        </id>
>        <property name="Name"/>
>        <property name="Price"/>
>
>        <component name="ProductDetail" class="ProductDetail">
>          <parent name="Product" />
>          <property name="CreateTime"/>
>           <property name="LastUpdated"/>
>        </component>
>    </class>
>
> Remove ProductID property from ProductDetail class
> In my opinion <generator class="hilo"/> and [ProductID] [int] IDENTITY
> (1,1) NOT NULL is somewhat inconsistent.
>
> >
> 

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to