• Post Reply Bookmark Topic Watch Topic
  • New Topic

I have a question related to design patter?  RSS feed

 
vicky saxena
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application I have a Databasemanager class which do basics database operations like insert, select ,delete , search of resords , which open connection do operation & closes connection.
My TitleDBAgent class & GroupDBAgent class extends this Databasemanager class .
& do the operation related to specific requirements like it creates the sql related to select the record in table & send this sql to getRecords method in the manager class.

My requirement is to create a generic method in manager class and execute the select query & return me Vector of DAO not Vector of Vector.

Is it possible����.. Can any one help
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need something to convert the result set to a collection of DTOs. Since the DTOs are different for every table or query, it will be hard to do that in the generic class. The caller might have to pass in a reference to a converter object, possibly itself.

How is this better than just getting the result set back from the DatabaseManager? It lets the DBM make sure the result set is closed. You could put the ResultSetToDTO method in its own class.

What do you think? Is that generic enough or no? Any other pros or cons?
[ December 02, 2005: Message edited by: Stan James ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!