title: Need to login to Hibernate with Database Username & Password dynamically
body: <p>Somewhat like how this link describes :
  <a href="https://stackoverflow.com/questions/18033288/username-and-password-in-hibernate-configurationfile">Programmatically configure Hibernate with dynamic username and password</a></p>
  
  <p>Only,
  I need the same implementation, but I am unable to specify <code>applicationContext.xml</code> instead of <code>hibernate.cfg.xml</code>, since my application specifies hibernate properties in a dataSource inside <code>applicationContext.xml</code>
  like so</p>
  
  <pre><code>&lt;bean id="dataSourceShrms" class="org.apache.commons.dbcp.BasicDataSource"&gt;
      &lt;property name="driverClassName" value="oracle.jdbc.OracleDriver" /&gt;
      &lt;property name="url" value="jdbc:oracle:thin:@192.168.100.155:1546:TSHRMS" /&gt;
      &lt;property name="username" value="${database.username}" /&gt;
      &lt;property name="password" value="${database.password}" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>EDIT :
  Use something like JDBC login <code>conn=DBUtils.getConnection(user, pass, host)</code> through Java (directly from web app UI), but using <strong>Hibernate</strong>.</p>