Nested Callback Handlers?

I am getting a set of data from the database where the query produces a repetition of data with a different “Special” value. For example the user “A” can be repeated twice, having three different “Special” values under the “Special Column”.

I am using a callback handler to retrieve the data and put it into a list, now additionally I want the Special column to have its own callback where for each user the specials list will be stored, so therefore the user data wont be repeatedly taken and stored into the list and I wont have to manually filter it out. Can anyone point me to a direction of achieving this?

Another way of achieving this is to concatenate the results into a string there itself, which would be easier, but the query seems to be complex and messy when I include the joins.

The code is below

    String query   = getQuery(SPECIALS_REPORT_QUERY);

    getJdbcTemplate().query(query, parameters, dataTypes, new RowCallbackHandler() {
        public void processRow(ResultSet rs) throws SQLException {

            SpecialsResultsSetDTO dto = new SpecialsResultsSetDTO();


            //there should be a callback handler or something to store the data to a list in the dto bean object (for the specials)


Any advice on solving this problem would be helpful

Regards, Milinda


In your dto cant you create an hashmap which would have the user as the key and special value as the column.

Leave a Reply

Your email address will not be published. Required fields are marked *