The problem I see with keeping a list stored is need to updata data in two places if a chance occurs (in the list and in the flatfile)
Regards<br /> <br />Ph.D.<br />SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD 2
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
I am also debating between caching the data or using RandomAccessFile stream. My initial thought on caching the record from the database is its size. In real life project, you never know the size of you database, and never know how big the database can grow to. If the database file grow too big, the jvm will run out of memory.
It is the same case dealing with RDB. One can't bring the whole database to the jvm, that is why we have to access the database every time we need to perform a query. I know the project scope is much smaller than real life project, but there are 100 points in general consideration. If the examiner try to test the project with larg size database file, say 150 Mb, and the JVM heap running at 128 mb (defualt), he will get an exception.
SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
thanks for the tip. I have never used java.lang.ref package before. I read the api, but I don't have a clear understanding of how to apply this technique to the issue.
If I can store reference to objects, where the object has to live?
for example: if I am reading the db file, and ecapsulate each record in a value object, then referenced this object. The object itself has to be created and stored on the heap, hence using the memory.
This tiny ad is guaranteed to be gluten free.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
|