If you use Spring you can encrypt the password in a properties file and then feed it into a datasource:
It would look something like this:
Code:
<bean id="dataSource" class="org.springframework.jdbc.datasource.SingleConnectionDataSource">
<property name="driverClassName" value="${driverClassName}" />
<property name="url" value="${dbUrl}" />
<property name="username" value="${dbUsername}" />
<property name="password" ref="dbPassword" />
</bean>
<bean id="textEncrypter"
class="net.foo.common.util.TextEncrypter">
<constructor-arg index="0" value="DES" />
</bean>
<bean id="dbPassword" factory-bean="textEncrypter"
factory-method="decrypt">
<constructor-arg index="0" value="${dbPassword}" />
</bean>
You could then pass the dataSource into the Hibernate factory. It might be a bit much if you don't already have Spring in the mix.
HTH
Tom