'hibernate.dialect' must be set when no Connection available error

前端 未结 9 1922
误落风尘
误落风尘 2021-02-20 01:22

I am getting the following error when using Hibernate:

\'hibernate.dialect\' must be set when no Connection available

And I am using a datasource fo

9条回答
  •  天涯浪人
    2021-02-20 01:52

    You will get this issue even if you have your configuration files having proper value but you don't configure it in the code.

    I was explaining hibernate, I forgot to use configure() before buildSessionFactory() so I was getting the error.

    You might want to recheck it.

    Previous code which was giving me error

    SessionFactory factory = new Configuration().buildSessionFactory();
    

    Changed code No Error

    SessionFactory factory = new Configuration().configure().buildSessionFactory();
    

提交回复
热议问题