This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Ammar Fakhruddin
Posts: 2
  • Mark post as helpful
  • send pies
  • 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 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?

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!