For defining an auto-incremented identifier in an entity we need the @Id annotation and the IDENTITY generator as follows:
@Entity
public class User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
…
}