This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm writing a webapp and I'm working on the data access piece right now. I'm basically using the data access pattern which I get and works well, but my question is, what is the best way to retrieve data and built a set of objects from a DB?
right now if I have a Widget class with thing1 and thing1 as attributes. My WidgetDAO class has the object itself, plus setPrimaryKey(), getPrimaryKey(), storeData() and some other methods.
But if I want to go into the DB and get all widgets where thing1 == someValue, is it best to have a WidgetReader class with a public static ArrayList<Widget> getWidgets() method?
that's how I did it last time, and it was ok, but I was wondering if there are some other design ideas out there I should know about.