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.
I think its the problem of not loading your hibernate.cfg.xml file in your application.
I too got the same problem. I have tried with the following code in my project:
Configuration cfg = new Configuration();
cfg.configure("hibernate.cfg.xml");
Then it has worked fine. Hope this will help.
I had this error with JPA, then I just added this line to application.properties:
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
based on this post: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
I you are using hibernate and InnoDB why don't you set the hibernate.dialect to org.hibernate.dialect.MySQL5 or org.hibernate.dialect.MySQL.
and the connection property to hibernate.connection.url.
I think the error cased by unloading hibernate.cfg.xml file after you have created the Configuration Object like this:
Configuration config = new Configuration();
config.configure("hibernate.cfg.xml");
Added the following in persistence.xml file,
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
Creation of ServiceRegistry instance separately and pass it to buildSessionFactory may cause this error. Try to create SessionFactory instance as follows:
private static SessionFactory factory;
factory = cfg.buildSessionFactory(
new ServiceRegistryBuilder().applySettings(cfg.getProperties())
.buildServiceRegistry());