0

I'm trying to do pagination on my webapp with MVC3 and nhibernate, the first page works fine but nothing else than SetFirstResult(0) works!

.SetFirstResult(request.pageIndex * request.pageSize).SetMaxResults(request.pageSize)

NHibernate.Exceptions.GenericADOException was unhandled by user code Message=could not execute query

InnerException: System.Data.SqlClient.SqlException Message=The column 'DossierN5_8_3_' was specified multiple times for 'query'.

I have searched a lot but I can't find anyone with the same problem.

ChrisF
  • 134,786
  • 31
  • 255
  • 325
John Doe
  • 49
  • 4
  • The error message is telling you that you have multiple column definitions. I'd look into that. – ChrisF Nov 21 '12 at 14:18
  • Thanks for the tip, but I dont really now how to approach that. – John Doe Nov 21 '12 at 14:36
  • 1
    Please post your NH query, as well as the underlying model and mapping. It will help understand why you tagged as "detachedcriteria", if you use a resultTransformer, if you use eager fetching. – jbl Nov 22 '12 at 12:06

1 Answers1

0

I had the same problem with SetFirstResult. I found that the problem appear when I use JoinAlias.

Can't explain the reason, but after renaming alias everything is ok.

In my case problem was exactly with aliases and I guess in some cases changing join type to JoinType.LeftOuterJoin might help to.