title: Displaying data from database in JTable
body: <p>I'm writing a program using jdbc that will be an interface to database(smth like CRUD aplication). I assume that I have to write a class(e.g. <code>DBCLass</code>) that will do all the operations with database(<code>select, update, insert, delete</code> and maybe some other logic that will be reduced to these operations). User interface consists of a set of tables and a few buttons. To use a Jtable I need to implement a class(e.g <code>Model</code>) which is a subclass of AbstractTableModel. So this class will display my data to the user. I need to implement such model for all tables in my database schema. I don't want to write the logic in that classes that display data to the user and I think it is not very good thing to write the logic code in such classes. But it is also incorrect to load all the data from the db table to memory(e.g. ArrayList) and then display it in <code>Model</code>.
  So, I want an advise which is the best way to solve such problem.</p>
  
  <p><strong>edit:</strong>
  A small example:</p>
  
  <pre><code>Statement stmt = ....;
  ResaultSet rs = stmt.executeQuery("SELECT * FROM table1");
  </code></pre>
  
  <p>javadoc says that executeQuery method returns a ResultSet object that contains the data produced by the given query. So If we have a lot of data(which size is more than permited size to our virtual machine), our program will fail.
  So my question is still relevant</p>