Hibernate Dialect must be explicitly set的错误(回钦波)的解答
之前在这总是报Hibernate Dialect must be explicitly set的错误,后来发现是
?/**
? * 解决办法:
? * 方法一:Configuration config = new Configuration();
? *?????? SessionFactory sf = config.configure().buildSessionFactory();
? *?????? Session s= sf.openSession();
? *?????? 而不是:
? *?????? Configuration config = new Configuration();
? *?????? SessionFactory sf = config.buildSessionFactory();
? *?????? Session s = sf.openSession();
? * 方法二:写一个 hibernate.properties文件 放在SRC目录 中,基本内容如下:
? *?????? hibernate.connection.driver_class = com.mysql.jdbc.Driver
? *?????? hibernate.connection.password = sa
? *?????? hibernate.connection.url=jdbc\:mysql\数据库url
? *?????? hibernate.connection.username=root
? *?????? hibernate.dialect=org.hibernate.dialect.MySQLDialect
?
?
?
更多了解、更多交流QQ:444084929? 或百度回钦波