'hibernate.dialect' must be set when no Connection available
2012-08-07 21:11
691 查看
出现这个问题的原因是少了一句话:configure();
private static SessionFactory buildSessionFactory()
{
return new Configuration().buildSessionFactory();
}
应该改成:
private static SessionFactory buildSessionFactory()
{
return new Configuration().configure().buildSessionFactory();
}
new Configuration()默认是读取hibernate.properties
所以使用new Configuration().configure()来读取hibernate.cfg.xml文件
参考文献:http://yklovejava-163-com.iteye.com/blog/787434
特记于此!以备勿忘!
private static SessionFactory buildSessionFactory()
{
return new Configuration().buildSessionFactory();
}
应该改成:
private static SessionFactory buildSessionFactory()
{
return new Configuration().configure().buildSessionFactory();
}
new Configuration()默认是读取hibernate.properties
所以使用new Configuration().configure()来读取hibernate.cfg.xml文件
参考文献:http://yklovejava-163-com.iteye.com/blog/787434
特记于此!以备勿忘!
相关文章推荐
- 'hibernate.dialect' must be set when no Connection available
- 'hibernate.dialect' must be set when no Connection available
- 'hibernate.dialect' must be set when no Connection avalable
- HTTP Status 500 - 'hibernate.dialect' must be set when no Connection avalable
- 'hibernate.dialect' must be set when no Connection available 异常处理
- org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available
- hibernate.dialect' must be set when no Connection available错误
- HibernateException: 'hibernate.dialect' must be set when no Connection available
- 异常:org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available
- hibernate异常 'hibernate.dialect' must be set when no Connection available
- hibernate连接数据库时候提示'hibernate.dialect' must be set when no Connection avalable
- ssh整合Caused by: org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection
- hibernate第二篇 org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' no
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set .
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set 解决方法
- Exception in thread "main" org.hibernate.HibernateException: 'hibernate.dialect' must be set when no
- Hibernate Connection cannot be null when 'hibernate.dialect' not set错误
- org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection avalable