Jump to content

Front End Developers Suggestions


Recommended Posts

Posted

Bro, nothing to do with front-end. Depends on how DAO layer is written. There are things like pessimistic and optimistic locking and lock modes. If you are using JPA or hibernate or any ORM framework, you use these modes and write a logic in DAO.

 

Look here

 

http://docs.oracle.com/javaee/6/tutorial/doc/gkjiu.html

 

http://docs.oracle.com/javaee/6/tutorial/doc/gkjhz.html

 

http://docs.oracle.com/javaee/6/tutorial/doc/gkjjf.html

 

edited: if you are not using ORM framework, you can still ask the DB to set the concurrency modes for a particular transaction. Its possible using JDBC, I'm not sure what technology you are using for data access.

 

 

What ever you said seemed to me like a problem where ...if two people are competing for one resource ...only one person is given the lead....with optimistic and pessimistic locking startegies(by gicing version numbers and restricing others not to update so that resource is locked)....

 

As htttp is stateless how can a client know the existence of change on the server ....at least for the version change info also... u need to poll the server...

 

Except in some publish subscribe or listener models ..im thinking solution is possible...

 

Please feel free to correct me if anything is wrong.... hope we learn for better...

Posted

What ever you said seemed to me like a problem where ...if two people are competing for one resource ...only one person is given the lead....with optimistic and pessimistic locking startegies(by gicing version numbers and restricing others not to update so that resource is locked)....

 

As htttp is stateless how can a client know the existence of change on the server ....at least for the version change info also... u need to poll the server...

 

Except in some publish subscribe or listener models ..im thinking solution is possible...

 

Please feel free to correct me if anything is wrong.... hope we learn for better...

 

No brother, there won't be a problem. The HTTP being stateless is completely different and unrelated to the DB concurrent access. HTTP statelessness can be managed using the  Session Management. Every web/application server that accepts the http requests are capable of providing that feature. And polling is also not required (it depends on the requirement).

 

Here is the use-case and the steps:

 

When one person (first user) accesses the DB for modification, if the other person (second person) wants to access he needs to be made aware that some one is editing the Data and ask the second user to wait and do his operation after a bit of time. This is normally accepted solution. This puts minimal load on both the web-server and the DB server.

 

This can be achieved using the lock modes while performing the transaction at DB level. If you set the right lock mode, when the user wanted to modify some data which is already being modified by someone, the data driver will throw a run-time exception (the exception is originated from the DB, but the driver class has its own way of sending the exception to the application), you will catch that exception in your application (Data access layer) wrap it and send a business message to the end user saying that the data is being modified and ask him to access after a bit of time.

 

Another solution is instead of wrapping the run-time exception in the form of some message, you keep polling until the earlier data modification by different user is completed. This is not good solution when there are too many write operations to the DB. It puts the load on the DB. And this also keeps the client-webserver connection alive until the http response is sent back to the user.

 

Another solution is wrap the run-time exception and send it to the browser/user and keep firing  ajax calls (you will send the session id also in the http request) till you are able to modify the data (obviously, after the first user finishes his data operation and gives up the lock).

Posted

 

can you guys post some links for dot net related...

 

 

Sorry bro, I have no idea how its done in .net. But it shouldn't be very difficult. These lock modes are normally provided by Data bases. You find out what kind of DB you are using and more than that find out the DB driver that you are using to access the DB. That driver will provide these lock modes and the data isolation levels for each transaction and tell the DB how to perform the DB operation. In your application, you need to instruct the driver how to perform the DB operations.

 

 

 

If you are using ORM, again, it depends on the kind of framework you are using with .net. You can use .net hibernate framework or .net entity framework and etc. Find those links, not sure if they are helpful.

 

http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application

http://www.asp.net/web-forms/overview/data-access/editing,-inserting,-and-deleting-data/implementing-optimistic-concurrency-cs

 

The ORM's also need to use the data drivers.

Posted

No brother, there won't be a problem. The HTTP being stateless is completely different and unrelated to the DB concurrent access. HTTP statelessness can be managed using the  Session Management. Every web/application server that accepts the http requests are capable of providing that feature. And polling is also not required (it depends on the requirement).

 

Here is the use-case and the steps:

 

When one person (first user) accesses the DB for modification, if the other person (second person) wants to access he needs to be made aware that some one is editing the Data and ask the second user to wait and do his operation after a bit of time. This is normally accepted solution. This puts minimal load on both the web-server and the DB server.

 

This can be achieved using the lock modes while performing the transaction at DB level. If you set the right lock mode, when the user wanted to modify some data which is already being modified by someone, the data driver will throw a run-time exception (the exception is originated from the DB, but the driver class has its own way of sending the exception to the application), you will catch that exception in your application (Data access layer) wrap it and send a business message to the end user saying that the data is being modified and ask him to access after a bit of time.

 

Another solution is instead of wrapping the run-time exception in the form of some message, you keep polling until the earlier data modification by different user is completed. This is not good solution when there are too many write operations to the DB. It puts the load on the DB. And this also keeps the client-webserver connection alive until the http response is sent back to the user.

 

Another solution is wrap the run-time exception and send it to the browser/user and keep firing  ajax calls (you will send the session id also in the http request) till you are able to modify the data (obviously, after the first user finishes his data operation and gives up the lock).

 

Thanks!

.

Posted

Bro, nothing to do with front-end. Depends on how DAO layer is written. There are things like pessimistic and optimistic locking and lock modes. If you are using JPA or hibernate or any ORM framework, you use these modes and write a logic in DAO.

Look here

http://docs.oracle.com/javaee/6/tutorial/doc/gkjiu.html

http://docs.oracle.com/javaee/6/tutorial/doc/gkjhz.html

http://docs.oracle.com/javaee/6/tutorial/doc/gkjjf.html

edited: if you are not using ORM framework, you can still ask the DB to set the concurrency modes for a particular transaction. Its possible using JDBC, I'm not sure what technology you are using for data access.

×
×
  • Create New...