Created
February 3, 2017 11:16
-
-
Save gokman/0c94e18aee1af45fa831dbeafe44d41c to your computer and use it in GitHub Desktop.
Spring data jpa primary key with sequence in postgresql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//user_id_seq is the sequence that defined in posgresql database for id column | |
@Id | |
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_id_seq") | |
@SequenceGenerator(name = "user_id_seq", sequenceName = "user_id_seq") | |
@Column(name = "id") | |
public int getId() { | |
return id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment