-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if we can do something about polymorphic query problems #123
Comments
Seems we will need secondary joins a.k.a. multiple from clauses in order to make that work in a spec compliant way. |
Let's call expressions that access properties from a subclass Here an example:
The query following polymorphic query will be supported.
JPA providers that don't support that natively which is every of them except for Hibernate, will get the following transformed query.
Note that in the above we support the rewriting of null equality checks of polymorphic join nodes to type checks. Type checks will be interpreted correctly and only rewritten accordingly. |
Note that JPA makes it impossible to do a JOIN FETCH for the relations. I already created an issue for that. https://java.net/jira/browse/JPA_SPEC-117 |
I don't see how we can fix this for now. |
Note that what is described here is actually a nice way to emulate the TREAT operator for broken JPA providers for most cases. This will be done as part of #120 |
Superseded by #409 |
There are some problems that we encountered when doing polymorphic property access in queries where the target property is only available in one of the possible types. This seems to only happen in hibernate when the base class is abstract.
http://stackoverflow.com/questions/18392252/access-subclass-properties-in-criteria-builder-jpa
http://stackoverflow.com/questions/6903783/jpa-criteria-api-query-property-of-subclass
http://stackoverflow.com/questions/23595594/exception-in-query-downcasting-to-subclass-with-treat-as
http://www.jroller.com/RickHigh/entry/round_2_jpa_hibernate_accessing
The text was updated successfully, but these errors were encountered: