Error with filters on joined-subclass as one-to-one

Description

We have following entities:

  • Customer, which has deleted property

  • IndividualCustomer, which is inherited from Customer and has one-to-one (mapped as many-to-one with unique=true) relation to Person

  • Person which has IndividualCustomer property as one-to-one with property-ref to IndividualCustomer's Person property

If we enable filter, which filters deleted customers by deleted property and get person with criteria, following SQL is generated:
SELECT ...
FROM Person this_
left outer join IndividualCustomer individual2_ on this_.Id = individual2_.PersonID and individual2_1_.Deleted = 1
left outer join Customer individual2_1_ on individual2_.IndividualCustomerID = individual2_1_.Id

This obviously fails because the "filtering condition" (individual2_1_.Deleted = 1) is in wrong join.

Environment

None

Attachments

2

Activity

Show:

Alex Zaytsev July 9, 2024 at 12:24 AM

Moved here.

Oskar Berggren July 27, 2014 at 12:36 PM

Note that NH2049.zip uses a criteria query, while NH2049-NHib-3.2RC1.zip uses HQL. Both fail. Combined and slightly reworked test cases, still failing, added to 3.4.x branch in 7240908de2ab17dbf44b46f1c69919f4d6c11682.

February 15, 2013 at 11:42 PM

Still happens in NHibernate 4 master.

Brian J. Sayatovic November 10, 2011 at 9:47 PM

Does anyone have a patch for this? I'd be willing to try it. This bug is stopping us from inserting data.

M. Uld July 28, 2011 at 12:08 PM

Still happen in Hibernate 3.2.0.3001. Attaching a NHibernate 3.2 test fixture with a simplier exemple to reproduce.

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created December 22, 2009 at 1:18 AM
Updated July 9, 2024 at 12:30 AM
Resolved July 8, 2024 at 11:43 PM
Who's Looking?