Java and Databases: A Practical Guide
Java and Databases: A Practical Guide
Summary:
The book "Java and Databases: A Practical Guide" is a comprehensive course on integrating Java applications with relational databases. The author, experienced developer and architect Andrey Smirnov, systematically guides the reader from the basics of SQL to professional techniques for working with Hibernate and Spring Data.
What this book is about
- SQL Basics and Database Design: normalization, indexes, keys, JOIN, subqueries.
- JDBC: connection, Statement, PreparedStatement, CallableStatement, working with ResultSet.
- Connection Pooling: HikariCP, connection optimization.
- Transactions and Isolation: ACID, isolation levels, transaction management in Java.
- ORM and JPA: Entity, relationships, JPQL, Criteria API.
- Hibernate: configuration, caching (L1 and L2), lazy loading, n+1 problem.
- Spring Data JPA: repositories, Query Methods, Specification.
- Database Migrations: Flyway, Liquibase.
- Testing: Testcontainers, H2 in-memory, mock DB.
- Performance: query plan analysis, optimization, batch inserts.
Who this book is for
The book is suitable both for beginner Java developers who want to master working with databases, and for experienced programmers who want to systematize their knowledge and learn modern practices (Hibernate 6, Spring Boot 3, Java 21). Code examples are provided in Java 17+ and can be easily adapted to any version.
What you will learn
- How to properly design a database schema for a Java application.
- How to avoid common mistakes when working with JDBC (connection leaks, SQL injection).
- How to configure Hibernate for maximum performance.
- How to write efficient JPQL and Criteria queries.
- How to work with transactions in distributed systems.
- How to test code that works with a database without a real database.
- How to migrate a database schema without data loss.
All examples are available in the GitHub repository and are accompanied by detailed comments. The book is written in a lively language with an emphasis on practice — each theoretical block is reinforced with a real-world task.
Format: PDF, EPUB, online version.
Volume: 380 pages, 12 chapters, 45 practical examples.