-1
I am using Angular 6+ and springboot. As Gero an id and recover it?
ex: I have the following page:
When the user clicks on "New" will make a post. And this id that was generated will appear in the Code field.
*I thought I’d make a query and get the last id from the bank, but I’m afraid this processing time will take the id generated by another user.
Hello, you didn’t expose how your back-end structure is doing with spring boot. But, when persisting an element in the database is returned the element with the id created if it is auto increment or automatically generated. I recommend returning the persisted object on the back or even just id. Making another api call to fetch the last id is insecure and costly.
– Pedro Pongelupe Lopes
It is a simple post - Repository.save(Entity) where Entity contains all variables etc.
– Cleriston Lincoln
I commented on the case of returning the last id. Suppose I have 1000 users clicking the button at the same time. It will give conflict, no?
– Cleriston Lincoln
This control is performed in the backend. Check the Notation @Transaction and its parameters. One in particular is the Isolation >>Good coding!
– jcebidanes