developping a new Java Spring MVC microservice i have encountered a minor issue. When i send a creation request for any entity, the id generated always follows the previous one.
My event entity id configuration
My user entity id configuration
For example, this is what i got from these 2 requests
User creation request (you can see the id value is 1)
Event creation request (you can see the id value is 2)
The created event Id is the last created user Id + 1 which i obviously do not want to happen. I want separate Id values for each entity. I want to know what i am doing wrong. Thank you
Your solution worker pretty well ;) I finally used it and added @SequenceGenerator annotation to initialize the count at 0.
@SequenceGenerator(name = "seq", initialValue = 0)
public class ClassName {
@Id
@GeneratedValue(generator = "seq")
private Integer id;
}
Thank you very much Daniel, that's kind of you.