views:

44

answers:

1

hi, i have readonly VIEWs in an existing Database and i'd like to get them with FHN. i tried mapping it the following way:

public class HhstMap : ClassMap<Hhst>
{
    public HhstMap()
    {
        Table("HHST");

        ReadOnly();

        Id();

        Map(x => x.Hkz);
        Map(x => x.Kapitel);
        Map(x => x.Titel);
        Map(x => x.Apl);
        Map(x => x.Hhpz);
    }
}

but i got an error: could not execute query [ SELECT this_.id as id3_0_, this_.Hkz as Hkz3_0_, this_.Kapitel as Kapitel3_0_, this_.Titel as Titel3_0_, this_.Apl as Apl3_0_, this_.Hhpz as Hhpz3_0_ FROM HHST this_ ]

this is ok cause there is no ID Column, but how can i do mapping with Fluent without the ID?

+1  A: 

Maybe this can help you: Fluent nHibernate no identity column in table…?

EDIT: Also, you could use a composite id, or maybe you need the latest version of Fluent Nhibernate?

Peter
it did not work for me. all objects with the same key are actually copies of the first that gets retrieved from the DB
blindmeis
I added two extra links you might want to try out.
Peter