Announcement Announcement Module
Collapse
No announcement yet.
why to extend HibernateDaoSupport Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • why to extend HibernateDaoSupport

    Hi ,

    This is my first post and i am newbie to spring . so please bear if my queries are foolish .

    If we have a MyDaoImpl class configured inside the application-context-hibernate.xml file as shown below :

    <beans>
    <bean id="myDao" class="MyDaoImpl">
    <property name="sessionFactory" ref="mySessionFactory"/>
    </bean>
    </beans>


    public class MyDaoImpl {

    private HibernateTemplate hibernateTemplate;

    public void setSessionFactory(SessionFactory sessionFactory) {
    this.hibernateTemplate = new HibernateTemplate(sessionFactory);
    }

    I have seen some coding where the DAO implementation class extends HibernateDaoSupport . Please tell what advantage one will get on exxtending the HibernateDaoSupport.


    Thanks in advance.

  • #2
    When posting code please use [ code][/code ] tags. The advantages is that you don't have to specify the SessioJNfactory and creating the HibernateTemplate yourself. That is it.

    Next to that it isn't recommended anymore to use HibernateDaoSupport or HibernateTemplate (if you are on Hibernate version > 3.0.1). Simply use the plain hibernate api. Why, search the forum I answered that question a couple of times.

    Comment


    • #3
      Thank you very much.

      Comment

      Working...
      X