- Git stash
The git stash command is used to stash away your current work and revert back to a clean working directory which matches the HEAD commit. Let’s say for example that you are in a middle of working on a feature branch and suddenly a customer issue comes up. At this point you want to […]
- Spring Data Query to DTO
We will show here how you can map a DTO to a query using constructor. First create your entity class. Here we will have a User class. Second create your DTO class. In this case we will have a UserDto. As you can see that all fields and values must be loaded into the UserDto […]
- Spring Data Native Query to DTO
Let’s show how you can map a native SQL query to a DTO directly. Using AliasToBeanResultTransformer All the fields in the DTO, in this case UserFullDto, must have the same names as the result set returned from the query. If a query field name is not found in the dto then it will through an […]
- Postgres – Aggregation and GROUP BY
count, sum, avg, min, max, and the rule that decides what may appear in the SELECT list. WHERE versus HAVING and why the order matters for speed, count(*) versus count(column) on nullable data, FILTER for counting several things in one pass, string_agg and array_agg, and GROUPING SETS for a subtotal row without a second query.
- Spring Data Custom Select Query with Join
In this tutorial, I am going to show you how to use JOIN in custom spring JPA queries. The join is always on the id column. Multiple Joins