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;
}
Tested against PostgreSQL 16

Note

Using GenerationType.SEQUENCE is vastly superior to IDENTITY in PostgreSQL for bulk inserts.