views:

50

answers:

0

alt text

hi, i created the following mappings with fluent nhibernate:

public class AuswahlMap : ClassMap<Auswahl>
{
    public AuswahlMap()
    {
        Table("AUSWAHL");

        Id(x => x.Id,"ID")
            .GeneratedBy.Sequence("SEQ_AUSWAHL");

        Map(x => x.Programm).Not.Nullable();;
        Map(x => x.Variante);
        Map(x => x.Returnkey).Not.Nullable();
        Map(x => x.Beschreibung);

        HasMany(x => x.RefFilters)
            .KeyColumn("IDAUSWAHL")
            .NotFound.Ignore()
            .Inverse()
            .Cascade.All()
            ;        
    }
}

public class RefAuswahlFilterMap : ClassMap<RefAuswahlFilter>
{
    public RefAuswahlFilterMap()
    {
        Table("REFAUSWAHLFILTER");

         Not.LazyLoad();

        CompositeId()
            .KeyReference(x => x.Auswahl,"IDAUSWAHL")
            .KeyProperty(x => x.Filterrank);

        Map(x => x.Filter);
    }
}

when i load the data from DB

var l = session.Linq<Auswahl>().Select(item => item).ToList();

i can see the following Sql created

SELECT reffilters0_.IDAUSWAHL  as IDAUSWAHL1_,
       reffilters0_.Filterrank as Filterrank1_,
       reffilters0_.IDAUSWAHL  as IDAUSWAHL3_0_,
       reffilters0_.Filterrank as Filterrank3_0_,
       reffilters0_.Filter     as Filter3_0_
FROM   REFAUSWAHLFILTER reffilters0_
WHERE  reffilters0_.IDAUSWAHL = 1363 /* :p0 */

i really dont know why reffilters0_.IDAUSWAHL as IDAUSWAHL3_0_, reffilters0_.Filterrank as Filterrank3_0_, is there twice.

i have to say i'm really new to nhibernate. maybe someone can help me out.