public Cursor<SyncLogDTOWithRelatedEntities> listLogEntries(final Timestamp onOrAfter, final Timestamp before)
 	throws DBException
 {
  PreparedStatementCursor<SyncLogDTOWithRelatedEntities> cursor =
   new PreparedStatementCursor<SyncLogDTOWithRelatedEntities>(mgr, LIST_ENTRIES_SQL)
   {
    @Override
    protected void bindParameters(PreparedStatement stmt)
    	throws SQLException
    {
     stmt.setTimestamp(1, onOrAfter);
     stmt.setTimestamp(2, onOrAfter);
     stmt.setTimestamp(3, before);
     stmt.setTimestamp(4, before);
    }

    @Override
    protected SyncLogDTOWithRelatedEntities loadInstance(ResultSet results)
    	throws SQLException, DBException
    {
     SyncLogDTOWithRelatedEntities instance = new SyncLogDTOWithRelatedEntities();
     long entryNumber = results.getLong(1);
     instance.setEntryNumber(entryNumber);
     int id = results.getInt(2);
     instance.setReplicaId(results.wasNull() ? null : id);
     id = results.getInt(3);
     instance.setFilterId(results.wasNull() ? null : id);
     instance.setFilterInverted(results.getBoolean(4));
     instance.setStarted(results.getTimestamp(5));
     instance.setOperation(results.getString(6));
     instance.setStatus(results.getString(7));
     instance.setReplicaHost(results.getString(8));
     instance.setReplicaUser(results.getString(9));
     instance.setReplicaPath(results.getString(10));
     instance.setFilterName(results.getString(11));
     if (null != params)
     {
      params.close();
      params = null;      
     }
     params = listEntryParameters(entryNumber);
     for (Map.Entry<String, String> param; null != (param = params.next());)
      instance.setParameter(param.getKey(), param.getValue());
     return instance;
    }
 
    @Override
    protected String legend()
    {
     return "listing synchronization log entries from " +
     	(null == onOrAfter ? "the beginning" : onOrAfter)
     	+ " to " + (null == before ? "the end" : before);
    }

    @Override
    public void close() throws DBException
    {
     try
     {
      if (null != params)
       params.close();
      params = null;
     }
     finally
     {
      super.close();
     }
    }

    private Cursor<Map.Entry<String, String>> params;
   };
   cursor.execute();
   return cursor;
 }