Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
How to set null values in result projection to zero with QueryDSL #305
Timo suggested me to report this incidence as a bug:
I like to know how to set the null value in the projection pronostico2.nropack.sum()...
When the pronostico table is empty in DB, the value returned in pronostico.nropack.sum() is null, but i want to be zero. I tried with coalesce like this: pronostico.nropack.sum().coalesce(0)
.. but i get no answer. Instead of that, i get a Cast Exception: Cannot convert Long to Integer...
Someone has the answer?
PD: The complete query is:
Extracted from my original question in http://stackoverflow.com/questions/13319628/how-to-set-null-values-in-result-projection-to-zero-with-querydsl.
Thanks, Timo. QueryDSL framework help me a lot for my undergraduate project, especifically the implementation of simulated annealing in Java for a package delivery software system.
Greetings from Lima, Peru.
PD: I didn't test the patch because the course has been completed, but it will be useful for future development to other people. Thanks again.