title: How to avoid duplicate code when writing various methods in DAOImpl class?
body: <p>I have following doubts. Need clarification:
  1) I have implemented getEmployee and addEmployee methods in my EmployeeDAOImpl class and both these methods have common code for Hibernate API such as SessionFactory, Session etc . How can I prevent that to avoid duplicacy of code?</p>
  
  <p>2) My Resource class can directly access data from DAO layer then why to go for a service layer? </p>
  
  <p>3) I read somewhere that in MVC architecture one layer should access data only from its immediate next layer e.g. Service layer should access data only from DAO layer. Is this statement true?
  Can someone also give me a suitable link or material which provide clear concepts of all MVC related jargons like Business objects, Value object, DTO etc coz I get these doubts quite often.</p>