• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create hibernate session dynamically

 
Anusha Gurumurthy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a spring-hibernate GUI application where I show a login screen for user to enter his user-name & password. I have to use this credentials to connect to my database.

My database related details are present in hibernate.cfg.xml. My applicationContext.xml has the following entry

<bean id="sessionFactory" lazy-init = "true"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:config/hibernate.cfg.xml"/>
</bean>

The sessionFactory is autowired to all my DAOs. How can I pass my username & password dynamically to my session factory from my code?

Regards
Anusha Gurumurthy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic