• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to access DAO

 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! This is a design question.

I'm using Hibernate and DTO for annotation mapping. I have DAO objects for persistance of these objects. My question is. How should I access the DAO objects.

Should I instantiate the DAO or is there some pattern on how to wrap the DAO?
 
dennis zined
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll probably have a service layer in your application which you could inject dao components via Spring framework. In your spring config, inject DAOs into your service component and expose service methods to your UI. Your code will probably look like this:



hope this helps.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!

Not to familiar with spring but i'll look into it. To many new framworks for me right now , Wicket, Hibernate, Maven, Struts2 and the list goes on. But I have read about the Service Layer and seems like a good id�.

// Mathias
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic