Database Table Name, RESTful API Endpoint, and Entity Class Name - jamongx/twitter-clone GitHub Wiki

When building applications, especially using ORM (Object-Relational Mapping) frameworks like Hibernate/JPA in Spring Boot, it's common to follow certain naming conventions.

Database Table Name

  • Typically, table names are plural (e.g., users). This is because a table holds multiple records of that entity.

RESTful API Endpoint

  • RESTful resource names are typically plural. This is because the resource usually represents a collection of entities. For example:
GET /users: Retrieves a list of users.
GET /users/{id}: Retrieves a specific user by ID.

Entity Class Name

  • Entity class names are typically singular because an instance of the class represents a single entity.
@Entity
@Table(name = "users")
public class User {
    // fields, getters, setters, etc.
}