Hi

>From your description I gather that the class is never used to instantiate
an object representing a record in the database. If that is the case, I
would make the methods static.
If the class IS used to represent a record in the database, obviously the
methods shouldn't be static, they should operate on the data the object
represents.

Unless you employ some sort of push that can force an update of the browser,
or you let a javascript on the web-page poll the servlet I don't think you
can ensure that everybody sees the updated data.
In another, non-web, system I once worked on, we solved this problem by
adding a timestamp column to all tables. When updating a row in a table the
sql statement had a timestamp=9878769897 appended to the where-clause. When
a record had been updated by someone else in the time between the a user
read the data till he decided to write them back, the update would fail and
the system would ask him to re-read the data, re-enter the changes and write
again.


My 2 cents.

Regards
Michael B. Pedersen

-----Oprindelig meddelelse-----
Fra: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:[EMAIL PROTECTED]]P� vegne af Kiran Chaugule
Sendt: Friday, September 08, 2000 2:36 PM
Til: [EMAIL PROTECTED]
Emne: Thread safe methods.


Hello Everybody,
    I am designing an application where there are a lot of database
operations, viz. query, insert, update, delete. I have a design problem.

    I have created a DB class which has a method which does all the
insert update and delete operations. Whenever I want to insert,  update
or delete a record, should I create a new instance of my DB class and
call it's method, OR create one instance of DB class per table OR make
my method in the DB class static. What are the design issues to be
considered?

    A lot of people have access to the same screens. How do I make sure
that the user is viewing the latest data at any stage?

    Thanking u in advance,
Kiran

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to