The best way to validate the DDL schema with Spring and Hibernate

Introduction In this article, we are going to see what is the best way to validate the DDL schema and the JPA entity mappings when using Spring and Hibernate. I decided to write this article after reading this Tweet:

PostgreSQL trigger consistency check

Introduction In this article, we are going to see how to implement a non-trivial consistency check using a PostgreSQL INSERT and UPDATE trigger. By using a database trigger after executing an INSERT or UPDATE, we can ensure that the sum of salaries in a given department does not exceed the maximum budget allocated for the given department.