Where should I add on the class level or on the field?

|
Paul Berger 2022-08-03 13:36:31
‼️ 2022 amazing softwares 💾 autocad adobe photoshop premiere indesign encoder charcter animate windows winrar autodesk crazytalk google earth 💽 all with genuine lifetime license 💻 just search 4 software_pc_bot‼️
Rahul 2022-08-03 13:56:03
How to create a logger file in spring boot

Is there any example code

Then please send

A R 2022-08-03 13:58:04
Hi!!!! I am working on a project and it has registration page for user where I am using email address for validation purpose if email exists we are throwing error message like email already exists.
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

N 2022-08-03 15:11:39
A R 2022-08-03 13:58:04
Hi!!!! I am working on a project and it has registration page for user where I am using email address for validation purpose if email exists we are throwing error message like email already exists.
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

springbootmicroservices-71429.jpg

VAifonin 2022-08-03 15:18:52
N 2022-08-03 15:11:39

Add for User annotations @Validated

Robux 2022-08-03 15:29:11
shikariman1 2022-08-01 19:39:37
Please Please suggest good resources/ YouTube/ udemy

Freecodecamp , amigoscosde , getarrays

SJ 2022-08-03 15:31:09
Hi ,

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

SJ 2022-08-03 15:31:40
Anyone suggest the correct version of log 4 j file
SJ 2022-08-03 15:33:19
springbootmicroservices-71434.jpg

VAifonin 2022-08-03 15:46:19
SJ 2022-08-03 15:33:19

Show full log.

A R 2022-08-03 15:58:36
VAifonin 2022-08-03 15:18:52
Add for User annotations @Validated

Hi victor

Where should I add on the class level or on the field ??

wolfy7777 2022-08-03 15:59:01
wolfy7777 2022-08-03 12:23:08
hi all I want to parse through a json and inside that json there is an array of json objects…. anyone could plz share the for loop code

{flightnumber: 111
end: 11
crw =[{no: 1 }{no:2}{no:3}]
}

anyone?

VAifonin 2022-08-03 15:59:11
A R 2022-08-03 15:58:36
Hi victor

Where should I add on the class level or on the field ??

class

A R 2022-08-03 16:00:13
VAifonin 2022-08-03 15:59:11
class

Sure will test this Viktor

Hope this will resolve my issue from loging in different browsers

Thanks !!!

SJ 2022-08-03 16:04:00
springbootmicroservices-71445.jpg
This is the issue viktor
Rohit 2022-08-03 16:12:45
VAifonin 2022-08-03 15:18:52
Add for User annotations @Validated

I think it is for group validation but here it the case is different. Correct if am wrong

VAifonin 2022-08-03 16:24:28
Rohit 2022-08-03 16:12:45
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?

A R 2022-08-03 16:27:50
VAifonin 2022-08-03 16:24:28
You working validation @NotEmpty over field email?

If this question is to me then

Answer is No Viktor

Rajpootakhil 2022-08-03 16:36:46
A R 2022-08-03 13:58:04
Hi!!!! I am working on a project and it has registration page for user where I am using email address for validation purpose if email exists we are throwing error message like email already exists.
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

A R 2022-08-03 16:38:26
Rajpootakhil 2022-08-03 16:36:46
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

Hi akhil

Same thought first came into my mind by later I realised that this will create performance issue

Don’t you think ??

Rajpootakhil 2022-08-03 16:42:24
A R 2022-08-03 16:38:26
Hi akhil

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

A R 2022-08-03 16:45:53
Rajpootakhil 2022-08-03 16:42:24
right, but data duplicacy will cause bigger problem than performance issue.
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

Rajpootakhil 2022-08-03 16:47:36
can’t we make email field as unique in databse,
Rajpootakhil 2022-08-03 16:47:45
by using @Column(unique=true)
A R 2022-08-03 17:08:47
Rajpootakhil 2022-08-03 16:47:45
by using @Column(unique=true)

Where in entity class ??

Rajpootakhil 2022-08-03 17:11:14
yes on email field, if you are using spring dataJpa
A R 2022-08-03 17:11:47
Sure @Rajpootakhil
ArJuNdO 2022-08-03 17:20:16
A R 2022-08-03 13:58:04
Hi!!!! I am working on a project and it has registration page for user where I am using email address for validation purpose if email exists we are throwing error message like email already exists.
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.

ArJuNdO 2022-08-03 17:21:30
On top of it, there are few more options, but world stopping mechanisms (synchronization, 9bject locking) is my last preference
A R 2022-08-03 17:27:20
ArJuNdO 2022-08-03 17:20:16
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.

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

|