Andrew Hassan
Andrew Hassan

Reputation: 591

CreateSQLQuery works but QueryOver doesn't with NHibernate

So I'm trying to execute a basic select query from a table to return the rows. Right now I have an object representing the data in the table and is mapped in the hbm.xml file. As far as I know, the mapping is correct (it's a simple table with an auto-incrementing key and a string value).

When I do:

session.CreateSQLQuery("SELECT * FROM db.table").List()

for example, the resulting query works.

However, if I do:

session.QueryOver<MyObject>().List()

the result is null.

Upvotes: 0

Views: 395

Answers (1)

Rippo
Rippo

Reputation: 22424

Usually when this happens it is because your XML file is not marked as an embedded resource in your project.

See here:-

enter image description here

Upvotes: 2

Related Questions