-2

hibernate连接postgresql的配置是什么?

代码是

import org.hibernate.cfg.Configuration;
public class StudentHibernate {
    public static void main(String[] args) {
        Configuration config = new Configuration();
        config .setProperty("hibernate.dialect","org.hibernate.dialect.PostgreSQL");
        config.setProperty("hibernate.connection.driver_class","");
    }
}
4

2 回答 2

1

尝试这个:

config .setProperty("hibernate.dialect","org.hibernate.dialect.PostgreSQLDialect");
config.setProperty("hibernate.connection.driver_class"," org.postgresql.Driver");

问候

于 2012-07-25T07:59:51.030 回答
0

我通常使用这个:

hibernate.connection.username=user
hibernate.connection.password=password
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.url=url
hibernate.connection.driver_class=org.postgresql.Driver
于 2012-07-25T07:58:51.997 回答