How do you implement joins in JPA criteria queries?
Use Root.join with JoinType.INNER or LEFT in the JPA Criteria API, add ON conditions, avoid N+1 queries with fetch joins, and use the metamodel.
2,886 posts about Java: questions with answers, tutorials and articles, newest first.
Use Root.join with JoinType.INNER or LEFT in the JPA Criteria API, add ON conditions, avoid N+1 queries with fetch joins, and use the metamodel.
CriteriaQuery is the JPA Criteria API interface for building type-safe, dynamic select queries in code. See a full example, joins, projections and the metamodel.
Build type-safe JPA criteria queries with CriteriaBuilder, Root and predicates. Examples cover dynamic filters, joins, aggregates and the static metamodel.
CriteriaBuilder is the JPA factory for type-safe, dynamic queries. See predicates, aggregates, joins, the static metamodel and when to prefer JPQL.
Build reusable, composable Specification methods in Spring Data JPA to run dynamic queries with optional filters, paging and joins.
Spring Data JPA's Specification interface builds dynamic queries from small composable predicates. See repository setup, combining rules, joins and paging.
Learn to build dynamic, reusable queries in Spring Data JPA using Specification and JpaSpecificationExecutor, with filtering, joins and paging examples.
@MappedSuperclass lets entities inherit shared columns like id and timestamps without a parent table. See a Jakarta Persistence example and its limits.
A durable @JmsListener needs a topic factory with subscriptionDurable, a stable client ID and a subscription name. Here is the full Spring Boot 3 setup.
Configure a durable topic subscription in ActiveMQ with Spring Boot, including the listener factory, client ID, publisher and operational pitfalls.
A JMS message selector lets a consumer receive only messages whose headers and properties match an SQL-like expression. See syntax, Spring examples and trade-offs.
Use JMS selectors with @JmsListener and JmsTemplate to deliver only matching messages from ActiveMQ to each Spring Boot consumer.
An ActiveMQ Session is a single-threaded JMS context that creates producers, consumers and messages, and manages transactions and acknowledgement modes.
Set JMS acknowledgment modes for ActiveMQ in Spring Boot with properties or a custom listener container factory, plus redelivery and dead letter handling.
The Spring JMS ErrorHandler is a hook for exceptions thrown by message listeners, used for logging and alerts while the transaction setting controls redelivery.
Let transient errors trigger redelivery, configure ActiveMQ back-off, and route poison messages to a dead-letter queue instead of swallowing exceptions.
Register a Jackson MessageConverter so JmsTemplate and JmsListener send and receive JSON objects over ActiveMQ, and avoid unsafe Java serialization.
@JmsListener turns a method into a JMS message consumer with a managed listener container. See queues, topics, concurrency and correct error handling.
Add the ActiveMQ starter, send with JmsTemplate and receive with @JmsListener. Includes JSON payloads, queues versus topics and reliability tips.
JmsTemplate handles connections, sessions and conversion so you can send and receive JMS messages with one call. See setup, JSON converters and receive tips.