bennini wrote:
why would u end up doing casts? the object type definitions are generic enough to allow for almost anything. i have a DAO.java interface with the above mentioned methods then implementations such as:
Well, let's say your Action (or whatever) updates one blog entry, you need:
BlogEntry entry = (BlogEntry) blogDAO.searchByPrimaryKey(blogId);
instead of
BlogEntry entry = blogDAO.searchByPrimaryKey(blogId);
Same for insert (which I usually implement so that it returns the object, now also with the primary key field that was not known before the insert). And, don't you need to implement DAO method like
public ArrayList search(Object blogEntry){
BlogEntry casted = (BlogEntry) blogEntry;
...
}
because otherwise you will be creating a new method instead of overloading the one from superclass?
Granted, that's not a huge inconvenicence. I guess I was more curious about what are the practical benefits?