I have a User table which has a foreign key to the UserType table. I
created a User object with a Type property that is mapped as a join to
the UserType table. Is there a way to insert a new User without
inserting a new UserType?
http://stackoverflow.com/questions/2083415/how-do-you-save-an-nhibernate-entity-with-a-joined-field
The <join> element is when two or more tables should be used for the
_same_ object.
/Oskar
2010/1/18 Robin Clowers <robin....@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "nhusers" group.
> To post to this group, send email to nhu...@googlegroups.com.
> To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
>
>
>
>
I have a User table with a foreign key to a UserType table. I would
like to have a single entity, User which has the properties from both
tables. To do this, I am using the <join> element. I realize I would
map this a relationship, but that is not what I want.
Two questions, first: is this supported? I was able to load a user
with the join mapping, but have not been able to save one. Second: if
it is supported, is it a good idea?
On Jan 18, 7:47 am, Oskar Berggren <oskar.bergg...@gmail.com> wrote:
> You are either confused, or express yourself confusingly. :) You
> don't provide technical details, but it sounds like you are using
> <join> when in fact what you have is a one-to-many relationship. Map
> this with <many-to-one> in the mapping for User.
>
> The <join> element is when two or more tables should be used for the
> _same_ object.
>
> /Oskar
>
> 2010/1/18 Robin Clowers <robin.clow...@gmail.com>:
>
>
>
> > Hi I originally posted this to stack overflow, but I didn't get an
> > answer quickly so I thought someone here might be able to help.
>
> > I have a User table which has a foreign key to the UserType table. I
> > created a User object with a Type property that is mapped as a join to
> > the UserType table. Is there a way to insert a new User without
> > inserting a new UserType?
>
> >http://stackoverflow.com/questions/2083415/how-do-you-save-an-nhibern...
Must the UserType be another table?
If you have a group of properties that can together be called
UserType, why do you believe it is a good idea to expose them as
properties directly on the User?
Obviously I don't know all the details but my gut feeling is that if
you want to categorize users, it sort of defeats the purpose if you
don't reflect this in you model by having a UserType entity.
/Oskar
2010/1/18 Robin Clowers <robin....@gmail.com>:
Thanks for your help Oskar, I did not realize join was only for 1 to 1
relationships.
On Jan 18, 8:15 am, Oskar Berggren <oskar.bergg...@gmail.com> wrote:
> I believe you will not be able to do this with <join>. The element is
> for when you have a 1-to-1 relationship.
>
> Must the UserType be another table?
>
> If you have a group of properties that can together be called
> UserType, why do you believe it is a good idea to expose them as
> properties directly on the User?
>
> Obviously I don't know all the details but my gut feeling is that if
> you want to categorize users, it sort of defeats the purpose if you
> don't reflect this in you model by having a UserType entity.
>
> /Oskar
>
> 2010/1/18 Robin Clowers <robin.clow...@gmail.com>: