File hibernate.cfg.xml:

<!-- Параметры коннекта --> <property name="connection.driver_class">org.postgresql.Driver</property> <!-- <property name="connection.url">jdbc:postgresql://192.168.1.63/test</property> <property name="connection.username">postgres</property> <property name="connection.password">postgres</property> --> <property name="connection.verifyServerCertificate">false</property> <property name="connection.requireSSL">false</property> <property name="connection.useSSL">false</property> <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property> <property name="hibernate.c3p0.min_size">5</property>... + маппинги 

Next HibernateUtil:

 private static SessionFactory sessionFactory = null; static { Configuration cfg = new Configuration().configure() .setProperty("connection.url", "jdbc:postgresql://192.168.1.63/test") .setProperty("connection.username", "postgres") .setProperty("connection.password", "postgres"); sessionFactory = cfg.buildSessionFactory(); } public static SessionFactory getSessionFactory() { return sessionFactory; } 

Fall all with an error that does not specify the username / password and url.
Is it even possible to specify only part of the configuration properties? Hibernate 5.2

    1 answer 1

    Can:)
    In the setProperty you need to write "hibernate.параметр"
    Example:

     Configuration cfg = new Configuration().configure() .setProperty("hibernate.connection.url", "jdbc:postgresql://192.168.1.63/test") .setProperty("hibernate.connection.username", "postgres") .setProperty("hibernate.connection.password", "postgres");