2. Field/Column Mappings
1. @Id
About
Important Points
Syntax and Usage
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
@Entity
public class Employee {
@Id
private Long id;
private String name;
}2. @GeneratedValue
About
Important Points
Syntax and Usage
Strategies for @GeneratedValue
@GeneratedValue1. GenerationType.AUTO
GenerationType.AUTODB
Strategy selected by Hibernate
Key Points
Example
2. GenerationType.IDENTITY
GenerationType.IDENTITYHow it Works
Key Points
Example
3. GenerationType.SEQUENCE
GenerationType.SEQUENCEHow it Works
Key Points
Example
Attribute
Meaning
4. GenerationType.TABLE
GenerationType.TABLEHow it Works
Key Points
Example
Attribute
Description
Quick Comparison of Strategies
Strategy
Who generates ID?
Supports Batch Inserts?
Performance
Portability
3. @Column
About
Important Points
Syntax and Usage
Attributes of @Column
@ColumnAttribute
Description
Example
Practical Usage Scenarios
Last updated