Sep 5th, 2010, 02:25 AM
Mapping for Spring-Hibernate DAO
I have a question on the feasibility of a DAO pattern type of thing with Spring and Hibernate.
I have the following hierarchy - a GenericHibernateDao which
implements CRUD operations (using HibernateTemplate). I like to have
specific instances inherit from this in the following manner. IUser is the interface
which defines User specific methods. IUserHibernateDao
will implements IUser and extends GenericHibernateDao. User is the entity that is mapped in the hbm.xml. For CRUD operations, I'm trying to save duplication by having IUserHibernateDao extend from GenericHibernateDao.
My question is how do I map this in Spring applicationContext files? If I put IUserHibernateDao's details in the bean mapping, I get an error message that looks like it is expecting IUser. Any thoughts/suggestions will be appreciated.
Sep 8th, 2010, 01:03 PM
I would suggest to check the docs and the Petclininc example which is in the spring distribution...
For a generic DAO approach you can check here: http://raykrueger.blogspot.com/2007/...ernatedao.html
Tags for this Thread