I was looking for a solution to the same issue and found the answer myself.
Write the code below.
@Id
@Column(name = "id", unique = true, nullable = false, insertable = false, updatable = false, columnDefinition = "bigint generated always as identity")
private Long id;