/* (non-Javadoc)
  * @see model.dao.IDataModel#insert()
  */
 @Override
 public Long insert() throws SQLException {
   try {
     Class.forName(Settings.DATABASE_JDBC_CLASSNAME);
   } catch (ClassNotFoundException e) {
     System.err.println("ClassNotFoundException: " + e.getMessage());
     e.printStackTrace();
   }
   Connection conn;
   PreparedStatement statement;
   try {
     conn = SQLiteManager.getInstance().getConnection();
     String sql =
         "INSERT INTO account_entries (account_id, booked_document_id, text, amount, created_time)"
             + " VALUES (?,          ?,                  ?,    ?,      ?)";
     statement = conn.prepareStatement(sql);
     statement.setLong(1, getAccount().getId());
     statement.setLong(2, bookedDocument.getId());
     statement.setString(3, text);
     statement.setDouble(4, amount);
     statement.setString(5, util.Date.toSqlTimeString(Calendar.getInstance().getTime()));
     statement.execute();
     sql = "SELECT last_insert_rowid()";
     ResultSet resultSet = conn.createStatement().executeQuery(sql);
     if (resultSet.next()) id = resultSet.getLong(1);
     else throw new SQLException("unable to fetch insert-id");
     resultSet.close();
   } catch (SQLException e) {
     System.err.println("SQLException: " + e.getMessage());
     e.printStackTrace();
   }
   return id;
 }
 @Override
 public AccountEntry createFromResultSet(ResultSet resultSet) throws SQLException {
   return new AccountEntry(
       resultSet.getLong("id"),
       new Account(resultSet.getLong("account_id")),
       new BookedDocument(resultSet.getLong("booked_document_id")),
       resultSet.getString("text"),
       resultSet.getDouble("amount"),
       util.Date.fromSqlTimeString(resultSet.getString("created_time")));
 }