JPA Entities & Relationships
JPA entities with @Entity, @Id, relationships (@OneToMany, @ManyToOne, @ManyToMany), @JoinColumn, cascade
1Which annotation marks a class as a JPA entity?
Which annotation marks a class as a JPA entity?
Câu trả lời
@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.
2Which annotation defines the primary key of a JPA entity?
Which annotation defines the primary key of a JPA entity?
Câu trả lời
@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.
3Which annotation customizes a column name in the database?
Which annotation customizes a column name in the database?
Câu trả lời
@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.
How to specify a table name different from the class name?
Which @GeneratedValue strategy uses a database sequence?
+27 câu hỏi phỏng vấn
Các chủ đề phỏng vấn Spring Boot khác
Spring Core - IoC & DI
Spring Boot Auto-Configuration
Spring Boot Starters
Application Properties & YAML
Logging with SLF4J & Logback
Spring Boot DevTools
Spring MVC Basics
Spring REST Controllers
Request & Response Handling
Exception Handling
Bean Validation
Spring Data JPA Basics
JPA Queries
Spring Data Repositories
Spring Security Basics
Spring Boot Actuator
Unit Testing with JUnit & Mockito
Spring Boot Testing
Profiles & Environment
RestTemplate & WebClient
Async & Scheduling
Caching with Spring
Spring WebFlux (Reactive)
Spring Transactions
Advanced Authentication & Authorization
JWT & Stateless Security
OAuth2 & Authorization Server
Spring Boot & Docker
Microservices with Spring
Spring Cloud Config
Performance Optimization
GraalVM Native Images
Nắm vững Spring Boot cho lần phỏng vấn tiếp theo
Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.
Bắt đầu miễn phí