So what I need is mapping an one-to-one relationship in a single table like I demonstrated in the original mail.
How can I do? Blog: http://www.cnblogs.com/JeffreyZhao/ Twitter: http://twitter.com/jeffz_cn From: Fabio Maulo Sent: Monday, August 10, 2009 9:32 PM To: nhusers@googlegroups.com Subject: [nhusers] Re: Mapping one-to-one relationship in a single table lazy loading for components does not have any sense. 2009/8/10 Jeffrey Zhao <je...@live.com> 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" <hi...@ukr.net> Sent: Monday, August 10, 2009 4:36 PM To: "nhusers" <nhusers@googlegroups.com> 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. > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhusers@googlegroups.com To unsubscribe from this group, send email to nhusers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---