Announcement Announcement Module
Collapse
No announcement yet.
hibernateTemplate: when to call in DAO Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • hibernateTemplate: when to call in DAO

    Hi guys,

    just a couple of things i want to clear up regarding this two classes:

    1. My DAO extends the HibernateDAOsupport class. If say for example a find method in my DAO is called from the save method of the same DAO so both methods are in the same class do i still need to go and call the getHibernateTemplate method?

    is it possible to pass the template through is that a recommended practice?

    for example

    MYDAO extends hibernateDAOSupoort{

    public void saveObject(object object)
    {
    HibernateTemplate hibTemp = gethibTemop();
    //call to other DAO method
    findDAO(object);
    }

    public findDAO(object obj)
    {
    does this method need to call the hibernate tempkate as well
    }

    }

    Thanks

  • #2
    is it possible to pass the template through (to the DAO method) is that a recommended practice?
    It's possible, but probably not a recommended practice. It's really only feasible if the method, receiving the HibernateTemplate, is not in the DAO interface, otherwise you can't call it easily from somewhere that doesn't have a HibernateTemplate handy (e.g. the business layer).

    Comment

    Working...
    X