javaspringspring-bootjpaentity

What is @Entity in Spring JPA?


Specifically, I am referring to javax.persistence.Entity.

Based on the documentation it shows when I hover the mouse over, in VS Code it states that:

Specifies that the class is an entity. This annotation is applied to the entity class.

What does it mean for Spring JPA that a class is an Entity?


Solution

  • A class of type Entity indicates a class that, at an abstract level, is correlated with a table in the database. Each object instantiated by this class indicates a tuple of the table itself, containing the information of the latter. I recommend that you find out about what object relational mapping is. I also recommend this page that talks about ORM in Spring.