Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are managing a list of telephone numbers. I suppose you are not really concerned with application performance at this point; you will not be making difficult queries through tons of data.</p> <p>Then why not use Hibernate/JPA together with an embedded database? This way, you can do CRUD on simple data but easily scale out to a relational model if needed. The embedded database manages caching, transactions, locking... The disadvantage is a steep learning curve.</p> <p>So if you want to avoid the steep learning curve, I suggest you use the Collections method. You are concerned with your application crashing if it runs out of memory. Is this a real problem, or just a theoretical one? Can't you slice up your data into parts, only loading a single part into memory at any given time and serialising the rest to disk. Something like:</p> <pre><code>private List&lt;DataSlice&gt; slices; public class DataSlice { private ArrayList&lt;Object&gt; data; private File backingFile; private void load() { data = deserialize(backingFile); } private void release() { if(dirty) save(data, backingFile); data = null; // data is garbage collected, but there is a risk the objects are still referenced in memory } private void doCrudOperation() { dirty = true; doSomething(); } } </code></pre> <p>This is apparantly already implemented in "vanilla-java" (the HugeCollections package): <a href="http://code.google.com/p/vanilla-java/" rel="nofollow">http://code.google.com/p/vanilla-java/</a></p> <p>Be warned though, it is probably better to go with an embedded DB in the long run. You need to learn about Java Entity Beans and java persistence, but you will be able to use this for years to come.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload