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

Paasing a collection or a single object

 
Gabriel Vargas
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I read a lot of posts to resolve some questions about muy assigment (B&S) , but I have a question than I can't find: If the find method is called form the client side (this method returns a list of contractor's ids) and later this client read each record from the server, what mechanism can be used to prevent than others client modifies (update or delete) records while the reading is finished? (this can arises exceptions like RecordNotFoundException)

I have as a guide the Andrew's Book, and think than this is very good. In this book methods of interface returns directly a List with the DVD's, but the adapter class should return only recNos?

Thanks for your suggestions.
 
Khaled Mahmoud
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding your first question which about reading a record while it is being updated, this is called dirty reads. In the assignment, you are not required to solve the issue of dirty reads.In my case I did not solve this issue.
 
Gabriel Vargas
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answer Khaled, it's now clear for me, it means if a record is deleted while is trying to read it, simple ignores it and continue reading next record(Apply for 2-tier architecture). I though than a syncrhonization mechanism but i'm thinking in a 3-tier architecture model.
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I think that you just make a serious mistake if you just try to ignore the dirty reads issue, you can take a look at : http://faq.javaranch.com/view?ScjdFaq - the last point.
This can be solved in a elegant way in a three tier architecture, but they depends a little on your implementation. The key is that the middle layer controls the communication between the ui and the database, if it control it can decide if the value was changed(or delete) in the meantime an react properly.

Regards
M
 
Gabriel Vargas
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mihai,

After read more posts, i decide to implement a 3-tier architecture solution, I like more this approach. Looking last point in javaranch faq i think that it talk more about updating an contractor (this involves read and update) than do a search(involves search and then read finded records). I think have dirty reads is allowed, and fits in a 2-tier solution because search and reads are made in the (thick) client but another solution is make search and reads in the server side usign a thin client, and delegates responsability to server (as I like to implement ). I appreciate a lot your points of view, it helps me to resolve this question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic