Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate and dao

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've read some posts here and got curious about dao and hibernate.
in my case i'm just developing an app for family , so its no pro stuff; anyway i'd like to have some links or code so that i can see dao+hibernate(stand alone app) working.
Can someone provide me that?
thanks in advance

EDIT:
in the meanwhile i discovered this link
and also found related stuff in HiA - page 308; but as i was coming here to edit my post i read this:
By the way, even if you're using Hibernate, it's still a good practice to wrap the Hibernate code inside a DAO. In other words, I'm assuming that by "DAO", you're referring to "DAO-with-hand-written-JDBC".
in this discussion, which left me very confused
[ February 28, 2005: Message edited by: miguel lisboa ]
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's really far simpler than all these threads are making it out to be.
  • JDBC is a data-access API
  • JDO is a data-access API
  • Hibernate is a data-access API
  • TOPLink is a data-access API

  • And then, completely unrelated to the above, we have the Data Access Object pattern which states that data access code should be factored out into its own class rather than sprinkled in among the business logic.

    The question "Which is better, Hibernate or DAO?" is totally meaningless. It's like asking "Which is better, Java or for loops?" If your application is complex enough, use the DAO pattern. Whether you write your DAOs using JDBC, JDO, Hibernate, or smoke signals is up to you.
     
    miguel lisboa
    Ranch Hand
    Posts: 1281
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    thanks
     
    Steven Bell
    Ranch Hand
    Posts: 1071
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I find smoke signals are very effective.
     
    Pj Murray
    Ranch Hand
    Posts: 194
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    This discussion thread has been refreshingly clear.


    The various APIs are persistence technology choices (see http://www.codefutures.com/weblog/corporate/archives/2005/02/data_persistenc.html for a comparison).

    Regardless of the persistence API you choose, DAOs are best practice.

    See here for a discussion of DAOs and ORM

    http://www.codefutures.com/weblog/andygrove/archives/2005/02/index.html


    I should point out that CodeFutures supports all of the persistence APIs mentioned above and can generate code with or without a DAO facade. So we're either sitting on the fence or providing maximum flexibilty - depending on how you look at it ;-)

    Regards
    PJ Murray
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic