• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it right to write a GenericDAO ?  RSS feed

 
Jimmy Yao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Struts,usually, we write entity beans for critical database tables, and.. every entity bean has it's own DAO. These DAOs do insert/update/delete/finder work over it's entity bean.
I wrote a genericDAO, handled all entity beans. Using RTTI(RunTime Type Identification), I am not sure if it's the general way to handle this problems?
Any suggestion?
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I certainly use a generic DAO to do all of my data access. Mine is more an entire Persistence Engine rather than a single DAO, but while it may lack in performance it makes up for it in flexibility and ease-of-coding. I never write SQL/deal with ResultSets any more; my engine does that for me.
This frees me from dependency on any one database or application server. This means that I can provide the same code to any application without having to change it to work against MSAccess or Oracle or XML data sources.
Of course I have to provide information to my engine for it to do its work, but I wrote a tool for that
My $.02
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the EJB forum.
Continue the conversation here.
[ May 12, 2003: Message edited by: Cindy Glass ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!