Connection cannot be null when 'hibernate.dialect' not set

后端 未结 15 1695
悲&欢浪女
悲&欢浪女 2020-12-16 11:12

having more issues with seting up hibernate with spring3. this time it is saying that connection is nul as the dialect is not set which it is on my hibernate.cfg.xml file.

15条回答
  •  一向
    一向 (楼主)
    2020-12-16 11:25

    You did't post your session factory initialization code. But I guess this is the same problem with this one

    From Hibernate 4.3.2.Final, StandardServiceRegistryBuilder is introduced. Please follow this order to intialize, e.g.:

    Configuration configuration = new Configuration();
    configuration.configure("com/jeecourse/config/hibernate.cfg.xml");
    
    ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
            configuration.getProperties()).build();
    sessionFactory = configuration.buildSessionFactory(serviceRegistry);
    

    Please double check your code.

提交回复
热议问题