front matter
When Cătălin asked me to write this foreword, I realized that for 17 years of my career, I’ve mostly been dealing with the problems that are discussed and solved in this book. Historically, we’ve come to a state where most data is persisted in relational DBMSs. The task may sound quite simple; save data in a database, read it, modify it if needed, and finally delete it. Many (even senior) developers don’t realize how much computer science there is in those several operations. Talking to a relational database from an OOP language like Java is like speaking to a person from another world who lives by completely different rules.
In the early years of my career, I spent most of my time just mapping “ResultSets” to Java objects without any sophisticated logic. It wasn’t hard, but it was really time-consuming. I was only dreaming, thinking that our architects wouldn’t suddenly change the object structure so that I’d have to rewrite everything from scratch. And I wasn’t the only one!
To save manual work and automate these translation tasks, frameworks like Hibernate, and later Spring Data, were created. They really do a lot of work for you. You just need to add them as a dependency, add some annotations to your code, and the magic will happen! This works perfectly on small projects, but in real life, projects are way bigger with a lot of corner cases!