Announcement Announcement Module
No announcement yet.
Method to obtain custom session in HibernateDaoSupport Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Method to obtain custom session in HibernateDaoSupport

    I've overloaded the Hiberate Session management to provide some custom features and wish to provide some of this custom Session management to HibernateDaoSupport. However, the getSession() methods are final. Is there anyway that I can extend HibernateDaoSupport to provide a custom getSession implementation?


  • #2
    As you can see from the sources all the methods are market final except initDAO which is the hook offered for subclasses. getSession() uses SessionFactoryUtils for retrieving the sessions so you can:

    1. either copy-paste HibernateSupportDAO to use your classes (ugly version)
    2. extend SessionFactoryUtils and/or HibernateTemplate and add your extra functionality and then use initDAO for any extra initialization if you need.
    Thus the calls delegated by DAOSupport to these classes will return what you need.


    • #3
      Thanks for your help.