Happen with a class mapped with subclass mapping, and a subclass has a one-to-one property mapped to another class using shared primary key. Query the subclass with join alias to the one-to-one class, IndexOutOfRangeException will be thrown.
(MsSql 2008, .Net 4.0)
A test case will be attached shortly.
@Oskar: Not exactly the same.
The problem with this one is the SQL generated is not complete: the condition in Where clause is missing, so the SQL where is like this: "... WHERE and Type='3'". So if NHibernate try to bind SqlParameter, IndexOutOfRangeException will be thrown, and if the SQL is sent to database, a SqlException.
The exception in #NH-3178 happen in a different place.
I have just attached a revised test fixture, which shows that the problem is not limited to QueryOver. HQL and CriteriaAPI is also affected.
Am I mapped the classes wrongly?
After remove property-ref="User" from mapping, all works well.
I misunderstood the use of property-ref.
Shall we close the issue?
I think the faulty SQL generation in this case is interesting, but it's not important now. Please close the issue.