Skip to content

NH-2049 - Error with filters on joined-subclass as one-to-one #1209

Closed
@nhibernate-bot

Description

@nhibernate-bot

Ville Häkli created an issue — 22nd December 2009, 1:18:51:

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" (individual21.Deleted = 1) is in wrong join.


cur3n4 added a comment — 5th April 2011, 17:19:04:

Still happening in Hibernate 3.1.0.4000


M. Uld added a comment — 28th July 2011, 12:08:36:

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


Brian J. Sayatovic added a comment — 10th November 2011, 21:47:03:

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


chris@foundry57.com added a comment — 15th February 2013, 23:42:24:

Still happens in NHibernate 4 master.


Oskar Berggren added a comment — 27th July 2014, 12:36:06:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions