I'm using QueryDSL in my current project, and in one instance I need to use native query instead of jpa one due to jpql limitations.
Thankfully it's quite easy to swap from one to another and keep the api abstraction layer by just switching from JPAQuery to JPASQLQuery, however after I do that the jpa entities are no longer mapped as result type.
Example:
Using JPAQuery:
QPriceModel pm = QPriceModel.priceModel;
List<PriceModel> fetch = new JPAQuery<PriceModel>(entityManager)
.select(pm)
.from(pm)
.fetch();
Will produce proper entities as result type:
But JPASQLQuery
QPriceModel pm = QPriceModel.priceModel;
List<PriceModel> fetch = new JPASQLQuery<PriceModel>(entityManager, new OracleTemplates())
.select(pm)
.from(pm)
.fetch();
Will only return column arrays as is
Is there any way to force JPASQLQuery to return entities without manually mapping them?
Im using QUERY_DSL_VERSION=4.2.1
TLDR
Query dsl no longer maps jpa entities after switching from JPAQuery to JPASQLQuery

