Hi Hibernate developers,
I stumbled upon an issue today and I am wondering whether the following would be possible
using Hibernate, and if not, whether such could actually be implemented, or if I actually
hit a boundary of the alias injection.
My problem has to do with trying to map the result set of a native query to an entity that
uses the JOINED InheritanceType. After adding the enitity to my NativeQuery as follows,
the aliases for the tables of the subclasses are not set properly (obviously). My question
is, though, would it be possible to set these as well? As I can’t figure this out from the
current documentation (that only states that all columns should be present in the result
set, which I assume to apply to a InheritanceType.SINGLE_TABLE primarily).
The code I am currently using to construct the query is as follows:
session
.createNativeQuery("SELECT {s.*} FROM my_super {s} LEFT JOIN my_sub_a {a} USING
(id)")
.addEntity("s", MySuper.class)
.getSingleResult();
Additional code is available on Github gist:
https://gist.github.com/JWGmeligMeyling/51e8a305f3c268eda473511e202f76e8
And my question is also posted on Stackoverflow (to gain some extra credits for the answer
;-) ):
http://stackoverflow.com/questions/39359924/add-entity-with-inheritancety...
Thanks in advance,
Jan-Willem