views:

135

answers:

2

Hello Guys... I updated the Npgsql driver to the last version (2.0.5) and got error in my NHibernate App... Mappings:

School mapping :

...

References(x => x.City);

...

And City Mapping:

Id(x => x.ID).GeneratedBy.Assigned();
Map(x => x.Name);
References(x => x.Microrregion);

Now, when I tried to load a School, I got a NHibernate.ObjectNotFoundException to object City... But with Npgsql 1.0 all works fine...

Any Idea?

Thanks

A: 

First, are you positive that the City exists? Can you run a SQL query against these two tables? That is, does SELECT * FROM School LEFT JOIN City ON School.City = City.Id WHERE School.Id = 12345 return what you expect?

If so, next make sure NHibernate is generating the query you expect. You can set the show SQL property on the Fluent interface like so:

PostgreSQLConfiguration
    .Standard // Or whatever dialect you are using
    .ConnectionString(...).ShowSql()

Once you have that set, NHibernate will write the queries it is executing and it may show up in your logging or unit tests or whatever, depending on how you have things setup.

Stuart Childs