There is one line in almost every Spring Boot tutorial that runs flawlessly on your laptop and slowly corrupts your database in production: spring : jpa : hibernate : ddl-auto : update # works on your laptop, quietly rewrites prod With ddl-auto: update , Hibernate looks at your entities on every startup and alters the live schema to match them. No migration file. No version. No review. No rollback. Two developers add different fields, deploy in a different order, and now staging and production have quietly diverged — and the day one of those "updates" needs to drop a column, Hibernate will happily take your data with it. In Episode 5 of Building Instagram's Authentication Backend , we do the opposite. The database is not something Hibernate improvises at boot — it is a versioned artifact, checked into git, owned by Flyway . We build the persistence layer in three deliberate steps: the SQL migration , then the JPA entities , then the Spring Data r...
Java HashMap is one of the most frequently asked topics in Java interviews. Many developers use it daily, but very few understand how it actually works internally . In this article, we will explain: What HashMap is How HashMap stores data internally Role of hashCode() and equals() What collisions are and how they are handled Improvements made in newer Java versions Time complexity of all major operations How to reduce frequent collisions All explanations are in simple terms , with examples . 1. What Is a HashMap? A HashMap stores data in key–value pairs . Example: Map<String, Integer> map = new HashMap<>(); map.put("A", 10); map.put("B", 20); Key characteristics: Keys must be unique Values can be duplicated Order is not guaranteed One null key is allowed Multiple null values are allowed Why HashMap is popular: HashMap provides very fast access to data. 2. How HashMap Stores Data Interna...