in common, hibernate sessionfactory is created in spring configuration file (eg spring-dao.xml) like;
<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>file:src/hibernate.cfg.xml</value>
</property>
</bean>
and then in dao,
<bean id="myProductDao" class="product.ProductDaoImpl">
<property name="sessionFactory" ref="mySessionFactory"/>
</bean>
in web.xml, we put the config file (spring-dao.xml) in contextConfigLocation;
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-dao.xml</param-value>
</context-param>
when the application is started, datasource is injected to all dao beans.
This was the summary, what my problem is, I do not want spring to connect to database on application startup. I have an admin(responsible for opening db connection after startup) and an admin applet working on remote machine, which communicates with web app servlet. database connection for web application should be opened if authentication is ok.
how can i achieve this goal?
The solution was not to hard; Create a datasource with no parameters initially, and then setting values after admin credentials ok.