14 High-Performance Java Persistence Tips

Introduction A high-performance data access layer requires a lot of knowledge about database internals, JDBC, JPA, Hibernate, and this post summarizes some of the most important techniques you can use to optimize your enterprise application. 1. SQL statement logging If you’re using a framework that generates statements on your behalf, you should always validate each statement effectiveness and efficiency. A testing-time assertion mechanism is even better because you can catch N+1 query problems even before you commit your code. 2. Connection management Database connections are expensive, therefore you should always use a… Read More

High-Performance Java Persistence – Part Two

Another milestone has been reached The second part of High-Performance Java Persistence book is out. It’s been almost a year since I started writing this book, and seven months since I published the first part.

High-Performance Java Persistence – Chapter 16 – Caching

Part 2, Chapter 16 Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material. Table of content This chapter explains how enterprise caching works, from database internal buffers, to application-level caching, and the second-level cache offered by Hibernate.

How to run database integration tests 20 times faster

Introduction In-memory databases such as H2, HSQLDB, and Derby are great to speed up integration tests. Although most database queries can be run against these in-memory databases, many enterprise systems make use of complex native queries which can only be tested against an actual production-like relational database. In this post, I’m going to show you how you can run PostgreSQL and MySQL integration tests almost as fast as any in-memory database.

High-Performance Java Persistence – Chapter 15 – Fetching

Part 2, Chapter 15 Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material. Table of content This chapter explains how fetching works in Hibernate.

High-Performance Java Persistence – Chapter 14 – Batching

Part 2, Chapter 14 Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material. Table of content This chapter explains how batch updates work in Hibernate.

High-Performance Java Persistence – Chapter 13 – Flushing

Part 2, Chapter 13 Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material. Table of content This chapter explains the inner-workings of the Hibernate Persistence Context implementation.

High-Performance Java Persistence – Chapter 12 – Inheritance

Part 2, Chapter 12 Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material. Table of content This chapter explains JPA inheritance from a data access performance point of view.

High-Performance Java Persistence – Chapter 11 – Relationships

Part 2, Chapter 11 Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material. Table of content This chapter explains JPA relationships from a data access performance point of view.

How does aggressive connection release work in Hibernate

Hibernate connection providers Hibernate needs to operate both in Java EE and stand-alone environments, and the database connectivity configuration can be done either declaratively or programmatically. To accommodate JDBC Driver connections as well as RESOURCE_LOCAL and JTA DataSource configurations, Hibernate defines its own connection factory abstraction, represented by the org.hibernate.engine.jdbc.connections.spi.ConnectionProvider interface.