Query Returning the same record multiple times
I have a query that should return 72 unique records based on the userid field. The problem is that what I am getting is 72 copies of the first record.
Here is the query: return Session .CreateCriteria() .Add(Restrictions.Eq("UserId", id)) .Li开发者_如何学运维st();
and here is what NUnit is running for the query: SELECT this_.USER_ID as USER1_12_0_, this_.RIGHTS_ID as RIGHTS2_12_0_, this_.FUNCTIONAL_AREA as FUNCTIONAL3_12_0_, this_.PERM_RIGHTS_ID as PERM4_12_0_ FROM PROFILE this_ WHERE this_.USER_ID = :p0;:p0 = 7943
When this query is run directly against Oracle - the results are correct.
Try using a mapping file generator and compare your mapping files as the problem most likely lies in your mapping files. There a plenty listed at http://nhforge.org/wikis/general/open-source-project-ecosystem.aspx. NhGen (http://sourceforge.net/projects/nhgen/) includes some very basic unit tests which might also assist you.
精彩评论