liveBook · Manning

Repository annotation

As explained in Java Persistence with Spring Data and Hibernate epub

The Spring Repository annotation identifies a component as a data-access repository and enables translation of persistence exceptions into Spring's unchecked data-access exceptions.

The Spring @Repository annotation marks a class as a data-access component and enables translation of persistence-specific exceptions into Spring unchecked data-access exceptions. section 14.2

DAO implementation

Annotate concrete DAO implementations, such as ItemDaoImpl and BidDaoImpl, with @Repository; pair them with @Transactional for transactional methods and @PersistenceContext for the EntityManager.

How Java Persistence with Spring Data and Hibernate epub covers it

How deep it goes
Explains component registration and persistence-exception translation, then demonstrates application on concrete DAO implementations.
Examples
Uses ItemDaoImpl and BidDaoImpl as repository implementations backed by an injected EntityManager.
What you can do after
Configure DAO classes as Spring components with automatic persistence-exception translation.
How it connects
Connects DAO pattern, Spring components, persistence exception translation, JPA EntityManager, and transaction management.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Java Persistence with Spring Data and Hibernate epub. The section links point to the parts of the book it draws on.