Hi Experts!
i need to give a unique id to a product on some user selections and display it to user, now i'm accomplishing it first go into db and get the max number, add one to this and finally display complete ID to the user. and now user select some other options and finally hit submit button and get record saved message.
Is it good way? i'm hitting database twice or more depends upon user's selection on changing.
Is there any best solution then plz feel free to suggest
Abdul QuddosPosted Apr 8, 2014, 2:46 AM
Jignesh TrivediPosted Apr 8, 2014, 2:42 AM
Are you think about the concurrent activity on this table?
I mean to say what happened when more the one user is requesting the max id of the table probably they all are get same max id....
Abdul QuddosPosted Apr 8, 2014, 2:35 AM
Jignesh TrivediPosted Apr 7, 2014, 8:49 AM
hi,
I think, there is no other way to achieve this. but in you current logic what happen when user abort the current transaction? because your number is already increment before it shown to the user.
Abdul QuddosPosted Apr 7, 2014, 7:43 AM
there are three categories each category has it's own credential to make unique key. let's say there are two categories A and B and one entry is going to be made against A the id of this category will be displayed to user like A1 and then user hit submit, in second insertion user will be displayed as A2 automatically. but when user enter record against B it would be showed to him as B1 for first time and B2 and B3 for second and third time respectively.
Sivaraman DhamodaranPosted Apr 7, 2014, 7:40 AM
The below link is useful:
Link