AdvancedAdvanced PostgreSQL
Spring Data JPA & PG: GenerationType.SEQUENCE (Part 9)
The query
SQL
-- Q: How does Hibernate interact with PostgreSQL regarding GenerationType.SEQUENCE?
@Entity
public class PracticeEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
}Note
“Using GenerationType.SEQUENCE is vastly superior to IDENTITY in PostgreSQL for bulk inserts.