IndexOutOfRangeException when querying subclass mapped object that have one-to-one mapping with other object

Description

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.

Environment

None

Attachments

2

Activity

Show:

Doan Van Tuan 
March 20, 2013 at 2:50 AM

I think the faulty SQL generation in this case is interesting, but it's not important now. Please close the issue.

Alex Zaytsev 
March 19, 2013 at 10:09 PM

Shall we close the issue?

Doan Van Tuan 
March 19, 2013 at 9:33 AM

After remove property-ref="User" from mapping, all works well.
I misunderstood the use of property-ref.

Doan Van Tuan 
March 19, 2013 at 8:47 AM

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?

Doan Van Tuan 
March 18, 2013 at 6:50 AM

@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.

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created March 18, 2013 at 3:03 AM
Updated October 16, 2014 at 3:45 AM
Who's Looking?