• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DAO Pattern

 
Danilo Dadonas
Ranch Hand
Posts: 59
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I'm new in Hibernate and I want to know if DAO pattern is a good pattern to create the logic to persist the objects.
I don't want to write code for access hibernate methods in my servlets for instance. Also, perhaps I'll persist the objects using XML or ObjectOutputStream and than I think DAO is the best pattern to do this.
I want to discuss it.

Thanks.
 
Jason Ferguson
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Danilo,

The DAO pattern is VERY good for Hibernate, and I wouldn't write an app without it. It is also possible to create a Generic DAO to handle methods that would be common to all of your code (such as a getAll() method).

I'd be happy to provide you a code example privately, but I don't post code publicly on JavaRanch anymore.

Jason

Originally posted by Danilo Dadonas:
Hi. I'm new in Hibernate and I want to know if DAO pattern is a good pattern to create the logic to persist the objects.
I don't want to write code for access hibernate methods in my servlets for instance. Also, perhaps I'll persist the objects using XML or ObjectOutputStream and than I think DAO is the best pattern to do this.
I want to discuss it.

Thanks.
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to add one word of caution, after having seen a number of broken DAOs
in this forum: because the level of standardization for DAOs is lower
than that of regular ORM usage, once you create your DAO layer, it's yours to maintain.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic