Christian - I've been using this solution and it's worked well so far :)

On 14 January 2011 09:18, Christian Erhardt
<[email protected]>wrote:

>  Hello,
>
> I have got a association object with a composite Id to resolve a
> many-to-many association. The .KeyReference() part in the CompositeId()
> leads to alot of selects which nhibernate performs so load the entities.
>
> Now I thought about mapping the columns twice. The id itself for the
> KeyProperty and then adding a Reference for the property. But nhibernate
> throws a "Index out of range exception" because it tries to add a parameter
> to the sql insert command for the two reference properties.
>
> Instead of
>
>          CompositeId()
>             .KeyReference(x => x.Skill, f => f.Type<boSkillBase>(),
> "cat_occu_skill__id")
>             .KeyReference(x => x.Gruppe, f => f.Type<boSkillGruppeBase>(),
> "cat_occu_skill_group__id");
>
> to
>
>        CompositeId()
>             .KeyProperty(x => x.SkillId, "cat_occu_skill__id")
>             .KeyProperty(x => x.GruppeId, "cat_occu_skill_group__id");
>
>          References(x => x.Gruppe)
>             .Fetch.Select()
>             .Column("cat_occu_skill_group__id")
>             .Class<boSkillGruppeBase>()
>             .Cascade.None();
>
>          References(x => x.Skill)
>             .Not.LazyLoad()
>             .Fetch.Select()
>             .Column("cat_occu_skill__id")
>             .Class<boSkillBase>()
>             .Cascade.None();
>
> Is there any advice for this? Hm... at second thought this is not really a
> fluent nhibernate question, but maybe someone is kind enough to give me an
> advice?
>
> Regards
>
> Christan Erhardt
>
> --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<fluent-nhibernate%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>



-- 

---
James Crowley
CEO, developerFusion - the global developer community -
http://www.developerfusion.com/
CTO, TechEye - all the technology news unfit for print -
http://www.techeye.net/

linkedin: http://linkedin.com/in/jamescrowley
twitter: http://twitter.com/jamescrowley

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en.

Reply via email to