I am writing an HQL query, as:
from a where ... or exists (from b inner join b.c where ...) and ...
I recieve back an entity of type
a out of this query. However, I have to also know if the
exists clause returned true or otherwise afterwards during my code. If the was SQL, I'd tack it to the choose list. However, even when I increase the HQL choose clause, to ensure that it might be:
select a, exists (from b inner join b.c where ...) as x from a where ... or x and ...
During my code Now i have to choose from viewing untyped data, or viewing typed organizations of type
a and throwing out my value
x that returned by using it.
It is possible to method to in some way return typed data plus the additional column?
You've two options because I view it:
1) Add the extra property like a read-only planned property for your entity, utilizing the
formula mapping to derive the worthiness using inline sql or perhaps a udf.
2) Get just the data you need back utilizing a custom hql query and employ the
aliastobeanresulttransformer to project to some strongly-typed dto which includes your fields of great interest.
Which route you decide to go is actually your decision, but I'd often lean towards option #2 so they won't pollute your domain model with needless fields.