But i need the individual elements of the Array i.e.every ArrayList stored in the Array as its elements and not the individual elements of the ArrayList.
Also, the elements of the Array are coming as null, so i guess, the individual elements of the ArrayList would also come as null, isnt it?
It would be better to change the code to not use an "array of ArrayList". An array of ArrayList ( or any collection within another collection ) makes the code difficult to read and maintain. Instead an ArrayList of POJOs would be more readable and maintainable.
That sounds fairly simple though before implementing it, what i would like to know is : say, i have n number of records in the database, then would i be able to access all these records at once using DTO?
Sorry, I don't understand your question clearly. Typically you'd iterate through the recordset, create one DTO object corresponding to one row retrieved, and add that DTO to the ArrayList.
So If you have 100 rows retrieved by a query, then you'd have an ArrayList that contains 100 DTOs.