Java and Databases: A Practical Guide
От JDBC до Hibernate: работа с MySQL, PostgreSQL и SQLite
Summary:
The book "Java and Databases: A Practical Guide" is a comprehensive guide to integrating Java applications with relational databases. The author, experienced Java developer Maxim Ilyin, systematically leads the reader from the basics of working with JDBC to modern frameworks (Hibernate, Spring Data JPA). Unlike academic textbooks, each chapter contains practical examples ready for use in real projects.
What the book covers
- Setting up connections to databases (MySQL, PostgreSQL, SQLite) via JDBC and connection pools (HikariCP, Tomcat JDBC).
- Writing SQL queries: SELECT, INSERT, UPDATE, DELETE, JOIN, subqueries, transactions.
- Working with ORM: Hibernate (Entity, annotations, cascades, lazy/fetch load), Spring Data JPA (repositories, Query Methods, Specification).
- Database schema migrations with Flyway and Liquibase.
- Performance optimization: indexes, caching (Hibernate L2 cache), pagination, batch operations.
- Protection against SQL injection, transaction management (Spring @Transactional, ACID).
- Testing the DAO layer using H2, Testcontainers, and Mockito.
Who this book is for
The book is aimed at Java developers of any level:
- Beginners — will learn JDBC, how to connect to databases, write queries, and process results.
- Intermediate — will deepen their knowledge of ORM, optimization, and testing.