liveBook · Manning

Spring Data JDBC Table annotation

As explained in Java Persistence with Spring Data and Hibernate epub

The Spring Data JDBC Table annotation maps a domain class to a relational database table.

The Spring Data JDBC @Table annotation maps a domain class to a named relational database table. Unlike javax.persistence.Table, it belongs to Spring Data JDBC. section 15.1

Mapping User to USERS

@Table("USERS") public class User { ... } explicitly associates User with the USERS table. Fields can use Spring Data JDBC @Column annotations for ID, USERNAME, and REGISTRATION_DATE.

A typical mapping works with related Spring Data JDBC annotations and repository infrastructure:

  • @Id identifies the entity identifier, while @Column names its corresponding database column. section 15.1

How Java Persistence with Spring Data and Hibernate epub covers it

How deep it goes
Defines explicit class-to-table mapping and distinguishes Spring Data JDBC annotations from JPA equivalents.
Examples
Uses a User class mapped to a USERS table with ID, USERNAME, and REGISTRATION_DATE columns.
What it assumes
Assumes basic Java classes and relational tables, while distinguishing Spring Data JDBC mappings from JPA mappings.
What you can do after
Apply it to associate a Spring Data JDBC entity with an explicitly named database table.
How it connects
Connects domain entities with Spring Data JDBC, @Id, @Column, CrudRepository, and relational database tables.

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.