I am getting data from database like this from one table.
Using java I want to group it based on offer ids and when I pass each offerId, I need to get lists of products[product details]
Image was not clear I will send it again
What I see is you haven't design your system ... you just have a batch of info retrieve from database and want it to do something on solution space ... and working this way will mess up your system to inflexibility and unmaintainable
well ... my suggestion on class design is to have 3 classes, i.e. Order , Offer , and Product.
Order one-to-many Offer
Offer one-to-may Product
in your Order class, you have a collection(e.g. ArrayList<Offer>)
in your Offer class, you have a collection(e.g. ArrayList<Product>)
normally, it is encourage to use ORM framework (e.g. Hibernate/JPA) other than JDBC
hope this will help you further research on your system
I want to extract all offer related data in offer object and and all product related in another object and depends on number of offers,there will be n number of objects having one Offer Object maps to one List of product objects in that offer
object will have
one offer object
List of products in that offer
There will be objects like this for number of offers
but in database there is no mapping ,all data in one line of row.
like order id,offer id,offer name,product name,product id,product description ..these all values in one row
there will number of rows will be equal to number of products.