Can any suggest me how to prevent this issue?
Where should I add on the class level or on the field ?
Where in entity class ?
Don’t you think ?
Is there any example code
Then please send
But today I am seeing it’s not behaving as expected
When I open registration page in two different browsers one is chrome another one is mozilla at same time then I am able create user with same email without getting any error.
In database only I’d is different for both user but email is same which should no be.
Can any suggest me how to prevent this issue???
This project is written in java
It’s a springboot microservices project
But today I am seeing it’s not behaving as expected
When I open registration page in two different browsers one is chrome another one is mozilla at same time then I am able create user with same email without getting any error.
In database only I’d is different for both user but email is same which should no be.
Can any suggest me how to prevent this issue???
This project is written in java
It’s a springboot microservices project
Add for User annotations @Validated
Freecodecamp , amigoscosde , getarrays
I cannot download the jar files from artifactory. Currently iam working in Java update to 8 version
Iam using log4j and log4j core as 2.17.1 versions

Show full log.
Hi victor
Where should I add on the class level or on the field ??
{flightnumber: 111
end: 11
crw =[{no: 1 }{no:2}{no:3}]
}
anyone?
Where should I add on the class level or on the field ??
class
Sure will test this Viktor
Hope this will resolve my issue from loging in different browsers
Thanks !!!

This is the issue viktor
I think it is for group validation but here it the case is different. Correct if am wrong
You working validation @NotEmpty over field email?
If this question is to me then
Answer is No Viktor
But today I am seeing it’s not behaving as expected
When I open registration page in two different browsers one is chrome another one is mozilla at same time then I am able create user with same email without getting any error.
In database only I’d is different for both user but email is same which should no be.
Can any suggest me how to prevent this issue???
This project is written in java
It’s a springboot microservices project
because both call is checking in db at same time->got no email present->created new user
what we can do is: we can use syncronised method for this
or
we can allow only one thread to operate on the db for write operation
or you can go for locking technique
what we can do is: we can use syncronised method for this
or
we can allow only one thread to operate on the db for write operation
or you can go for locking technique
Hi akhil
Same thought first came into my mind by later I realised that this will create performance issue
Don’t you think ??
Same thought first came into my mind by later I realised that this will create performance issue
Don’t you think ??
right, but data duplicacy will cause bigger problem than performance issue.
but i think there are some locking mechanisms you can do R&D
but i think there are some locking mechanisms you can do R&D
One more thought is there in my mind to use redis
But I don’t have any idea on redis
How its works
Where in entity class ??
But today I am seeing it’s not behaving as expected
When I open registration page in two different browsers one is chrome another one is mozilla at same time then I am able create user with same email without getting any error.
In database only I’d is different for both user but email is same which should no be.
Can any suggest me how to prevent this issue???
This project is written in java
It’s a springboot microservices project
There few solutions for this,
1. Make db column unique( if possible), this won’t save race condtion in transaction. Use serialization transaction on the create method, which aquire lock on db table which won’t give solution to uncommitted data.
2. Before insert the record write a query to get count of users by mail, if it has values email already exists. ( this won’t need db could update). Remember the transaction as mentioned above.
3. Above two won’t work if there is db sharing, or if your db is not strongly consistent, in that case use a cache layer where data has to be populated after successful creation and it has to be check on creation time.
Why locks/verions won’t work, locks are for existing objects. As your case is for new object which are not in db. Unless you implemented a pessimistic lock to compare the values in the memory which has the currently going transaction objects.
1. Make db column unique( if possible), this won’t save race condtion in transaction. Use serialization transaction on the create method, which aquire lock on db table which won’t give solution to uncommitted data.
2. Before insert the record write a query to get count of users by mail, if it has values email already exists. ( this won’t need db could update). Remember the transaction as mentioned above.
3. Above two won’t work if there is db sharing, or if your db is not strongly consistent, in that case use a cache layer where data has to be populated after successful creation and it has to be check on creation time.
Why locks/verions won’t work, locks are for existing objects. As your case is for new object which are not in db. Unless you implemented a pessimistic lock to compare the values in the memory which has the currently going transaction objects.
Hi Arjun
Your first option sound good
But if we make it as db column unique then we will not be able to store duplicate email
We have two cases in our project first is incognito mood where duplicate email can be accepted and other non congnito mood where duplicate email can not be accepted
If I do so it will break our existing feature