I suppose you can do something like this
Code:
Configuration loConfig =new Configuration(file);
String loPassword = loConfig.getProperty("connection.password")
loPassword = decrypt(loPassword, someKey);
loConfig.setProperty("connection.password", loPassword);
loConfig.configure();
But this won't make your code secure. It just makes it a bit more difficult to get the password. You need to get the key from somewhere. It is either harcoded or in config file ( i assume you don't want to enter it each time your program starts). So instead of reading the code in hibernate config file i need to.copy the whole program, set a breakpoint in Configuration.configure and i have your DB password. Yes, it is better than a plaintext password. but if someone wants it he can have it no time.
I would rather make sure that noone but the admin can can access your config files. If someone has access to that file you have already lost.