[nhusers] Re: Mapping one-to-one relationship in a single table

2009-08-10 Thread Jeffrey Zhao
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 


  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" 
  Sent: Monday, August 10, 2009 4:36 PM
  To: "nhusers" 
  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:
  >
  > 
  >
  >   
  >
  >
  >
  >
  >
  >  
  >  
  >   
  >
  >
  >
  > Remove ProductID property from ProductDetail class
  > In my opinion  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
-~--~~~~--~~--~--~---



[nhusers] Re: Mapping one-to-one relationship in a single table

2009-08-10 Thread Jeffrey Zhao
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 


  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" 
  Sent: Monday, August 10, 2009 4:36 PM
  To: "nhusers" 
  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:
  >
  > 
  >
  >   
  >
  >
  >
  >
  >
  >  
  >  
  >   
  >
  >
  >
  > Remove ProductID property from ProductDetail class
  > In my opinion  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
-~--~~~~--~~--~--~---



[nhusers] Re: Mapping one-to-one relationship in a single table

2009-08-10 Thread Stefan Steinegger

I agree with Fabio. The table needs to be selected anyway. It does not
make sense to only read half the columns from the table, and read the
rest in another query. Usually, the most expensive are db roundtrips
and joins.

I think hival's mapping is what you need.

You need to know what it means to use components. They are no
independent entities and can only be loaded with the parent. You can't
have a query for ProductDetails in your case, only for Products (but
you can filter them by details of course).


On 10 Aug., 15:32, Fabio Maulo  wrote:
> lazy loading for components does not have any sense.
>
> 2009/8/10 Jeffrey Zhao 
>
>
>
>
>
> > 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" 
> > Sent: Monday, August 10, 2009 4:36 PM
> > To: "nhusers" 
> > 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:
>
> > > 
> > >        
> > >           
> > >        
> > >        
> > >        
>
> > >        
> > >          
> > >          
> > >           
> > >        
> > >    
>
> > > Remove ProductID property from ProductDetail class
> > > In my opinion  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
-~--~~~~--~~--~--~---



[nhusers] Re: Mapping one-to-one relationship in a single table

2009-08-10 Thread Fabio Maulo
lazy loading for components does not have any sense.

2009/8/10 Jeffrey Zhao 

>
> 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" 
> Sent: Monday, August 10, 2009 4:36 PM
> To: "nhusers" 
> 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:
> >
> > 
> >
> >   
> >
> >
> >
> >
> >
> >  
> >  
> >   
> >
> >
> >
> > Remove ProductID property from ProductDetail class
> > In my opinion  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
-~--~~~~--~~--~--~---



[nhusers] Re: Mapping one-to-one relationship in a single table

2009-08-10 Thread Jeffrey Zhao

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" 
Sent: Monday, August 10, 2009 4:36 PM
To: "nhusers" 
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:
>
> 
>
>   
>
>
>
>
>
>  
>  
>   
>
>
>
> Remove ProductID property from ProductDetail class
> In my opinion  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 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
-~--~~~~--~~--~--~---



[nhusers] Re: Mapping one-to-one relationship in a single table

2009-08-10 Thread hival

To use associations your table should contain a foreign key. In your
current table definition you should use component, and the mapping
like this:



   





  
  
   



Remove ProductID property from ProductDetail class
In my opinion  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 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
-~--~~~~--~~--~--~---



[nhusers] Re: Mapping one-to-one relationship in a single table

2009-08-10 Thread YJingLee















 


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