I'm trying to learn "spring boot" and I don't know if I'm doing something wrong or I don't understand something. I'm creating an entity class with variables with ID among others, so I want to automatically generate the ID using
@ID
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
and to get the id value I created the get method
private int getId(){ return id};
But every time in every object ID equals 0,
I tried using other types, changed Int to Integer and every time Id was 0 or zero.
Am I doing something wrong? Maybe I can't return this auto-generated ID?