rollback on a static method
In a spring boot application, in a save method.
Concurent request duplicate record in spring jpa under transaction
Hi i use spring jpa to insert a record,my problem is if id exist on database use this record otherwise generate it and this generation process must be transactional.Before i insert record i check it is exist on database.My problem is when two request come at same time this control is not working.i put unique constraint to database but that time one of the request failed.How can i make record exist case under transaction control for concurent request?
@transactional
Public
void
save() { checkexist ? Useit: create