• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

I have a question related to design patter?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
It's feeding time! Give me the food you were going to give to this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic