• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Pass DB connection on the fly to hibernate session for the DAO based on spring-HibernateDaoSupport

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing an application based on spring hibernate using myeclipse .
I generated Spring DAOs using database explorer and manage to do different DB operations for testing, using a static datasource defined in the applicationContext.xml (NOT THE ONE BELOW)

Now, for the actual application. Each user in my company has his own Oracle user. Therefore it is required to use individual user based connection for any application.
So for each hibernate session I have to create a new oracle connection based on the individual user. Datasources and ConnectionPool does not work here.
(Grrrrr I know, you will not find this in normal applications but this is how our environment works.)

I have generated DAO based on myeclipse and each DAO is extended by default by org.springframework.orm.hibernate3.support.HibernateDaoSupport class which uses getHibernateTemplate() method to execute database operations. Internally HibernateDaoSupport class uses the default session factory as shown in the below applicationContext.xml where I don’t specify the Oracle connection details as I want to pass the connection on the fly.

Is there a way to pass the oracle connection to hibernate session for the generated DAOs?

Would anybody like some fudge? I made it an hour ago. And it goes well with a tiny ad ...
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic