• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

createRecord / updateRecord - suggestions needed.

 
Muthaiah Ramanathan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

In the createRecord or updateRecord methods, first I loop through all the records to find a match. If there is one, I throw a DuplicateKeyException.

After that I am again looping through all the records to find a deleted record in case of creation.

Once the create or update on the record is done, I loop through all the records (I have a cache) to write all of them to the DB File.

I can see that these loops will consume A LOT OF TIME in the huge DB Files. Is this a concern for this assignment? What is your suggestion? How are you all doing the above steps in those methods?

Thanks,

Muthaiah.
[ October 13, 2005: Message edited by: Muthaiah Ram ]
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Muthaiah.
Are your specs clear about when that exception must be thrown?
Mine (UB 1.2.1) doesn't say anything about a primary key.
And nothing in my assignment makes me think there must be one.
IMO these method prototypes are showing a general funcionality, but in my case these exceptions are never thrown.
Regards
 
Marcio Aun Migueis
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muthaiah,

I have some doubts about this exception, DuplicateKeyException. How to compose this key ? I recently create a post about it.

If you loop through all the records, why do you don�t ask for a deleted record at the same time. Save the first deleted record founded in a variable and use this position to insert your record.

M�rcio
 
Muthaiah Ramanathan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are your specs clear about when that exception must be thrown?
Mine (UB 1.2.1) doesn't say anything about a primary key.
And nothing in my assignment makes me think there must be one.

Yes, For me either, the specs is not clear - it doesn't say whether it be must thrown - No primary keys.

It was my choice. Several people have decided not to throw it, while some have thrown that. Refer to the thread - When to throw DuplicateKeyException and I am just following what Daniel Simpson had said.

Regards,

Muthaiah.
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, i would explain it in my choices.txt.
Why to choose that key.
What are the perfomance problems in your algorithm.
And how they can be solved.

Anyway i think it is not the simplest way.

Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic