# JPA Entities & Relationships (Spring Boot) > JPA entities with @Entity, @Id, relationships (@OneToMany, @ManyToOne, @ManyToMany), @JoinColumn, cascade - 30 interview questions - Mid-Level - [Interview Questions: Spring Boot](https://sharpskill.dev/en/technologies/spring-boot/interview-questions.md) ## 1. Which annotation marks a class as a JPA entity? **Answer** @Entity is the mandatory annotation to declare a class as a JPA entity that will be mapped to a database table. Without this annotation, the EntityManager cannot manage the object's lifecycle. Each entity must also have a unique identifier annotated with @Id to be valid. ## 2. Which annotation defines the primary key of a JPA entity? **Answer** @Id identifies the field that will serve as the primary key for the entity. This annotation is mandatory on at least one field of each entity. The primary key guarantees the uniqueness of each record and allows JPA to properly manage merge, refresh, and remove operations. ## 3. Which annotation customizes a column name in the database? **Answer** @Column allows customizing the mapping between a Java field and a database column, particularly to define the column name, its length, whether it accepts null values, or if it is unique. Without this annotation, JPA uses the Java field name as the default column name. ## 27 more questions available - How to specify a table name different from the class name? - Which @GeneratedValue strategy uses a database sequence? Sign up for free: https://sharpskill.dev/en/login ## Other Spring Boot interview topics - [Spring Core - IoC & DI](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-core-ioc-di.md): 22 questions, Junior - [Spring Boot Auto-Configuration](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-boot-auto-configuration.md): 20 questions, Junior - [Spring Boot Starters](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-boot-starters.md): 18 questions, Junior - [Application Properties & YAML](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/application-properties-yml.md): 16 questions, Junior - [Logging with SLF4J & Logback](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/logging.md): 20 questions, Junior - [Spring Boot DevTools](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-boot-devtools.md): 15 questions, Junior - [Spring MVC Basics](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-mvc-basics.md): 20 questions, Mid-Level - [Spring REST Controllers](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-rest-controllers.md): 20 questions, Mid-Level - [Request & Response Handling](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/request-response-handling.md): 20 questions, Mid-Level - [Exception Handling](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/exception-handling.md): 25 questions, Mid-Level - [Bean Validation](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/bean-validation.md): 25 questions, Mid-Level - [Spring Data JPA Basics](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-data-jpa-basics.md): 25 questions, Mid-Level - [JPA Queries](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/jpa-queries.md): 30 questions, Mid-Level - [Spring Data Repositories](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-data-repositories.md): 25 questions, Mid-Level - [Spring Security Basics](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-security-basics.md): 25 questions, Mid-Level - [Spring Boot Actuator](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-boot-actuator.md): 20 questions, Mid-Level - [Unit Testing with JUnit & Mockito](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/testing-junit-mockito.md): 30 questions, Mid-Level - [Spring Boot Testing](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-boot-testing.md): 30 questions, Mid-Level - [Profiles & Environment](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/profiles-environment.md): 20 questions, Mid-Level - [RestTemplate & WebClient](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/resttemplate-webclient.md): 24 questions, Mid-Level - [Async & Scheduling](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/async-scheduling.md): 25 questions, Mid-Level - [Caching with Spring](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/caching.md): 25 questions, Mid-Level - [Spring WebFlux (Reactive)](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-webflux.md): 25 questions, Mid-Level - [Spring Transactions](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/transactions.md): 30 questions, Senior - [Advanced Authentication & Authorization](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/authentication-authorization.md): 30 questions, Senior - [JWT & Stateless Security](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/jwt-stateless-security.md): 20 questions, Senior - [OAuth2 & Authorization Server](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/oauth2-authorization-server.md): 20 questions, Senior - [Spring Boot & Docker](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-boot-docker.md): 19 questions, Senior - [Microservices with Spring](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/microservices-basics.md): 25 questions, Senior - [Spring Cloud Config](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/spring-cloud-config.md): 19 questions, Senior - [Performance Optimization](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/performance-optimization.md): 30 questions, Senior - [GraalVM Native Images](https://sharpskill.dev/en/technologies/spring-boot/interview-questions/graalvm-native-images.md): 20 questions, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/en/technologies/spring-boot/interview-questions/jpa-entities-relationships