• 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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

 
Greenhorn
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?



THANKS
 
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic