String sql = "select adminType, adminData, caid, module, time, username, certificateSNR, event, comment from LogEntryData where ( "
String sql = "select "+LOGENTRYDATA_COL+" from LogEntryData where ( "
    public Collection query(Query query, String viewlogprivileges, String capriviledges) throws IllegalQueryException {        debug(">query()");        if (capriviledges == null || capriviledges.length() == 0 || !query.isLegalQuery()) {            throw new IllegalQueryException();        }        Connection con = null;        PreparedStatement ps = null;        ResultSet rs = null;        try {            // Construct SQL query.            con = JDBCUtil.getDBConnection(JNDINames.DATASOURCE);            String sql = "select adminType, adminData, caid, module, time, username, certificateSNR, event, comment from LogEntryData where ( "                    + query.getQueryString() + ") and (" + capriviledges + ")";            if (viewlogprivileges.length() == 0) {                sql += " and (" + viewlogprivileges + ")";            }            ps = con.prepareStatement(sql);            //ps.setFetchDirection(ResultSet.FETCH_REVERSE);            ps.setFetchSize(LogConstants.MAXIMUM_QUERY_ROWCOUNT + 1);            // Execute query.            rs = ps.executeQuery();            // Assemble result.            ArrayList returnval = new ArrayList();            while (rs.next() && returnval.size() <= LogConstants.MAXIMUM_QUERY_ROWCOUNT) {                LogEntry data = new LogEntry(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getInt(4), new Date(rs.getLong(5)), rs.getString(6), rs.getString(7)                        , rs.getInt(8), rs.getString(9));                returnval.add(data);            }            return returnval;        } catch (Exception e) {            throw new EJBException(e);        } finally {            JDBCUtil.close(con, ps, rs);        }    } // query