Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make this data model in mysql?

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am working on a web application where this is like multiuser-multiuser interaction with system


Abstarct is suppose I want to sell something and then I go on someone website and place my product for sale and that message will be send to backend operator of that website.problem is there is more than one backend user who serves request of user of that web application.I want to make something like if a frond end user has read message send by some user then that message will not go to other users.

But I am not getting any Idea how to implement it?
 
Tapas Chand
Ranch Hand
Posts: 583
8
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am totally confused by these 2 statements.
Kishor Joshi wrote:...that message will be send to backend operator of that website...

Kishor Joshi wrote:...if a frond end user has read message send by some user then that message will not go to other users

If message is sent to backend operator then why it will be read by front end user?

Do you want something like this?
Once a backend user serves the request, it should not be available for other backend users to serve.
For this you can just update the record in DB as soon as it is served.
Or, if you want to restrict other backend users from serving the request while it is opened and ready to be served at any backend user, then you have to update that record while opening.
You have to identify the event after which the request should not be available to be served.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tapas

Thanks I got one idea for this
let me try it If I will face some problem will update it
 
Tapas Chand
Ranch Hand
Posts: 583
8
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome
Do remember to post the solution if you get one.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I have a doubt that how can I make other event unavaiable to other user when one user is viewing that event

I am using AJAX(Like facebook) so If a request is arrived then that will go to all users.

Then it might be case that all will click simultaneously

How to handle this seneraio?
 
Tapas Chand
Ranch Hand
Posts: 583
8
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simultaneous updates can be prevented at database level.
Have a look at this post in ranch. Hope this helps.
http://www.coderanch.com/t/455850/JDBC/databases/tackle-simultaneous-updates-user-single
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tapas

But suppose request has arrived to two user and both receive at time user-1 at (t+x) and user-2 at (t+x) and they also update at (t+x+y) and (t+x+y)

I want some logic to handle at this level so that one user will not waste time in reading when some other user is reading and working on it

 
Tapas Chand
Ranch Hand
Posts: 583
8
BSD Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tapas Chand wrote:...You have to identify the event after which the request should not be available to be served

This is what I said in a previous post.
If you want to restrict other users from even reading the request, then locking can be used when a user clicks on the request to read it.
I assume that reading a request is similar to Coderanch. For example, when "Recent Topics" is clicked we have all the posts displayed.
And when we click on one post it opens for reading. So you want to restrict other users to open a post if that is opened by any other user, right?

If opening the request is restricted, then few other scenarios have to be handled,
like what if User1 has opened the request to read, so others cannot open the request. Then User1 closes the request without replying/serving.

Again this completely depends on the business requirement.

And if you are worried about simultaneous events, then do not worry. Database handles it quite well.
Following is my understanding. Hope I am explaining it correctly.
If 2 simultaneous requests(R1 and R2) goes to DB for a lock, DB accepts one request and the other request waits.
So if request R2 acquires the lock, exception is thrown for request R1 (I am talking about pessimistic locking in hibernate).
And the excpetion can be handled in Java and give some user friendly message to the Backend user of the application like, this post has been opened by some other user.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic