I found another solution. If you have full source, then add the following get
method to GenericDao:

        protected Class<T> getPersistentClass() {
                return persistentClass;
        }

This allows to retrieve the persisted class' name in your DAOs. So you can
add to your ConfirmDetailsDao:

   public List<T> findAllOrderByAlpha();

The implementation looks like this:

   public List<T> findAllOrderByAlpha() {
         String className = getPersistentClass().getName();

         return getHibernateTemplate().find(
            "from " + className + " c order by c.name");
   } 

Looks pretty simply.

If you have no full-source, then just add a new property to your
ConfirmDetailsDaoImpl:

   private Class<T> persistedClass;

For safety reasons, I chose a slightly different name. I don't know if there
would be any other effect if I'd
call it 'persistentClass'.

Martin 

-- 
View this message in context: 
http://www.nabble.com/GenericDao-and-Class-Hierarchy---Approach--tp14672300s2369p19256735.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to