> 2010/9/3 Frans Bouma <[email protected]>
> 
>              I hadn't looked at id-bag. When I change it, it indeed works.
There
>       is a downside to this though: if the intermediate entity has a
compound PK,
>       it won't work. Admitted that's an edge case, but it's still odd.
> 
> It's not only an edge case, but an impossible case. How do you think that
> nhibernate will generate the composite pk for the items when inserting?
Its
> not even supported an assigned id.

        There's no inserting done _through_ the collection, as the
intermediate entity is a full normal entity (Order). Hence the collection is
_readonly_. 

>       What's more
>       odd is that the .xsd suggests that <collection-id> accepts child
<column>
>       elements, however it also requires a column + type (why?)
attributes,
>       suggesting that <column> child elements are not really part of the
'key'.
> 
> 
>              The whole thing feels inconsistent: <key> inside <set>
suggests that
>       the PK is defined with that, so that's re-defining the pk, which is
bad (it
>       creates this problem),
> 
> Because "key" means the key of the entity where the collection is
contained,
> it is not the Primary Key of the intermediate table... Never the "key" is
> the PK.

        To my knowledge, <key> inside <set> specifies the FK field in the
related entity/table. Otherwise how is it able to join otherwise?

>        however <collection-id> in <idbag> re-defines the PK 
>       of the intermediate entity again as well, while it's already defined
in the
>       intermediate entity's mapping itself.
> 
> It is a conceptual problem. I have never maped a single table in two
> differents places like that.... I think you are doing it wrong.

        I don't map a _table_ twice, I map them once :) Customer onto
'Customer', Order onto 'Order', and Employee onto 'Employee. I then want the
Customer.Employees collection be mapped onto the m:n relationship (customer
1:n order m:1 Employee). This is only possible in NH if 'order' is either
not an entity (only PK/FK fields) or the fk fields form the PK, otherwise it
has a problematic mapping.

> It is true that nhibernate does not do nothing with that information, lets
> said nhibernate doesn't guess the collection id, doesn't look for another
> entity with the same table name, and so on.
> Also, I think that an SchemaExport will fail badly.

        a M:N is never exported in a schema, as a relational model doesn't
have a notion of a m:n. 

                FB 

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


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