Allow polymorphic formula definition
Description
Environment
Activity

Tatu Teräväinen October 13, 2012 at 4:40 PM
Referring to https://groups.google.com/forum/#!topic/nhusers/YobtLOLJ6Rw
I added a pull request for a couple of tests that demonstrate this issue. https://github.com/nhibernate/nhibernate-core/pull/152
The fix might be something along the lines of what I committed into a branch in my fork:
https://github.com/acutus/nhibernate-core/commit/69f11a798e66c4976f8cf2f19c1e92abad31fcbd
This commit is only the start for the possible fix, but fixing would require changes e.g. in ToColumns-method @ AbstractPropertyMapping:48 as well to include all the results with the propertyPath. Now formulaTemplate is only used when the column is null, but all available results with ORs should be used for correct queries. (e.g. ... WHERE this_.company_name like 'queryParameter' OR this_.first_name || ' ' || this_.last_name like 'queryParameter' (see the tests)). I'm not aware enough of the NHibernate internals to know where this kind of query building should take place, so I didn't create a proper fix and pull request for this.

Alex Zaytsev October 13, 2012 at 12:53 PM
May be implemented with union-subclasses.

Fabio Maulo September 30, 2010 at 10:08 AM
A hierarchy is uploaded using a single query with join or a simple select.
In a single query for the hierarchy the column can be present a single time.
Which formula should be applied ?
Details
Details
Assignee
Reporter

I'd appreciate possibility to declare different formula for one property for each member of inheritance hierarchy so as the property mapping could behave polymorphic. I already described the problem here: http://groups.google.com/group/nhusers/browse_frm/thread/ed29057c3b0726a7 . At the moment only one formula definition works through whole inheritance tree.
Sample model classes:
I'd like to define different formula for DisplayName property of Store and Driver subclass to be able to query over the property like this: session.QueryOver<TransferParticipantBase>().Where(x => x.DisplayName == "XY").List()