- Git reset
Get list of commits to choose from git log Git reset can change the branch pointer to point to any commit in the tree. git reset –hard <hash> $ git reset –hard 07a2a46 HEAD is now at 07a2a46 Updated index.html If you quickly check the log, you will see no history of the commits […]
- 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.