I keep getting one value from this LinkedHashMap it's either the first [ if (resultset.next()) ] or the last [ while(resultset.next()) ], only one result is coming back but I want the full map. How do I return all rows in the table that fit my criteria? Any help would be appreciated.
/** A method to list all previous statuses for a certain user given the userID */
public StringBuilder showStatusHistory(int userID) {
    try {
        Date date;
        String status;
        preparedStatement = createStatement("select statusDate,statusText from statusTable where userID = ?");
        preparedStatement.setInt(1,userID);
        resultSet = preparedStatement.executeQuery();
        StringBuilder allStatus = new StringBuilder("");
        statusesList = new LinkedHashMap<>();
        while (resultSet.next()){
            date = resultSet.getDate(1);
            status = resultSet.getString(2);
            statusesList.put(date,status);
        }
        Set<Date> statusTime = statusesList.keySet();
        for(Date k:statusTime){
            allStatus.append(k+" "+statusesList.get(k));
        }
        return allStatus;
    }
    catch (SQLException sqlE){
        sqlE.printStackTrace();
    }
    return null;
/** A helper method was used to minimize code duplication. It works for sure */
private PreparedStatement createStatement(String query) {
    try {
        connection = DB_ConnectionConfiguration.getConnection();
        this.query = query;
        preparedStatement = connection.prepareStatement(query);
        return preparedStatement;
    } 
    catch (SQLException sqlE) {
        sqlE.printStackTrace();
        return null;
    }
}
 
    