Advertisement
Guest User

Untitled

a guest
Apr 4th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. <property name="connection.provider_class">org.jasypt.hibernate4.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider</property>
  2.  
  3. <property name="connection.encryptor_registered_name">configurationHibernateEncryptor</property>
  4. <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
  5. <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  6. <property name="connection.url">jdbc:mysql://localhost:3306/aprendiendojsf?autoReconnect=true</property>
  7. <property name="connection.username">root</property>
  8. <property name="connection.password">ENC(lhFCMXdRkAw7Cz5JU17lvg==)</property>
  9. <property name="show_sql">true</property>
  10. <property name="current_session_context_class">thread</property>
  11.  
  12. public class HibernateUtil {
  13.  
  14. private static SessionFactory sessionFactory = null;
  15.  
  16. static {
  17. try {
  18. // Create the SessionFactory from standard (hibernate.cfg.xml)
  19. // config file.
  20. sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
  21.  
  22. StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
  23. encryptor.setAlgorithm("PBEWithMD5AndDES");
  24. encryptor.setPassword("clave");
  25. HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance();
  26. registry.registerPBEStringEncryptor("configurationHibernateEncryptor", encryptor);
  27. } catch (Throwable ex) {
  28. // Log the exception.
  29. System.err.println("Initial SessionFactory creation failed." + ex);
  30. ex.printStackTrace();
  31. }
  32. }
  33.  
  34. public static SessionFactory getSessionFactory() {
  35. return sessionFactory;
  36. }
  37.  
  38. INFO: HHH000046: Connection properties: {user=root, encryptor_registered_name=configurationHibernateEncryptor, password=****}
  39.  
  40. WARN: HHH000342: Could not obtain connection to query metadata : Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement