Sorry for the late reply.

This is a quote off the AR web site/documentation (the site is currently
down):

> The one-to-one implemented by NHibernate is often misunderstood. It is used
> for classes that share primary keys
>
http://74.125.153.132/search?q=cache:oS8SbbInWrQJ:www.castleproject.org/activerecord/documentation/v1rc1/usersguide/relations/onetoone.html+activerecord+one-to-one&cd=1&hl=en&ct=clnk&gl=au&client=firefox-a

This post by Ayende provides more details of how NHibernate actually works
with this relationship type:
http://ayende.com/Blog/archive/2007/05/10/NHibernate-onetoone.aspx

On Wed, Sep 9, 2009 at 5:42 PM, chitech <[email protected]> wrote:

>
> Hi
>
> I have this relationsship
>
> User Table:
> int UserId primary key,
>
>
> Blog Table:
> int BlogId primary key,
> int UserId foreign key
>
> One user can only have one blog.
>
> I have tried with OneToOne on both side, but the profiler shows it
> want to join on both primary keys. I have also tried
>
> class User
> {
>   [OneToOne]
>   public virtual Blog Blog {get; set;}
> }
>
> class Blog
> {
>   [BelongsTo("UserId")]
>   public virtual User User {get; set;}
> }
>
>
> with same result. Is the only solution to use HasMany and BelongsTo
>
> >
>


-- 
Jono

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to