jOOQ vs Hibernate JPA: JPA for writes, jOOQ for reports
Native queries return List<Object[]>, and renaming a column blows up production. A comparison of Hibernate JPA and jOOQ's type-safe SQL, and how to run both in the same transaction.
Native queries return List<Object[]>, and renaming a column blows up production. A comparison of Hibernate JPA and jOOQ's type-safe SQL, and how to run both in the same transaction.
One log line on an entity annotated with @Data can trigger a whole cascade of queries. How Lombok rewrites the AST inside javac, the traps in @Data, @EqualsAndHashCode, @Builder and @SneakyThrows, and how to block them.
The database gets an UPDATE without a save() call, a read-only API eats all the RAM, and the connection pool hangs because of a slow client. The Hibernate mechanics behind each one, and how to deal with them.
A search screen with 20 filters built by concatenating JPQL strings will sooner or later invite SQL injection. Here is how the Criteria API, Hibernate 6 SQM and Specification build type-safe dynamic queries.
A repository so concise that you forget Hibernate sits underneath, until you hit N+1 or a @Transactional that does not roll back. Notes on derived queries, projections, Specifications and locking.
Added @Transactional but nothing rolls back, or getting UnexpectedRollbackException? How Spring AOP proxies manage transactions, plus propagation, isolation, common traps and custom aspects.
A hand-written UPDATE query throws TransactionRequiredException? The shared Spring Data annotations (@Query, @Modifying, auditing), data mapping and pagination across JPA, MongoDB and Redis.
Why does @ManyToMany with a List make Hibernate wipe the join table and INSERT everything again? How to split it into two @OneToMany through a Join Entity with @EmbeddedId and @MapsId.
A slow API because of N+1, an exploding heap because of a Cartesian product, a StackOverflowError because of @Data: the rules for using @OneToMany and @ManyToOne in JPA/Hibernate in production.
You declared @OneToOne(fetch = LAZY), yet Hibernate still fires N+1 SELECT statements? The cause sits on the mappedBy side, and there are 3 fixes: @MapsId, a unidirectional mapping, and bytecode enhancement.