Use the following code on the hibernate official document to make this exception in the test times.
Org.hibernate.HibernateException:Access to Dialectresolutioninfo cannot is null when ' Hibernate.dialect ' not set
Package Org.hibernate.tutorial.util;import Org.hibernate.sessionfactory;import Org.hibernate.boot.registry.standardserviceregistrybuilder;import Org.hibernate.cfg.configuration;public Class Hibernateutil { private static final Sessionfactory sessionfactory = Buildsessionfactory (); private static Sessionfactory Buildsessionfactory () { try { //Create the sessionfactory from hibernate.cfg.xml< C4/>new Configuration (). Configure (). Buildsessionfactory ( new Standardserviceregistrybuilder (). build ()); } catch (Throwable ex) { //Make sure your log the exception, as it might be swallowed System.err.println ("Initial Se Ssionfactory creation failed. "+ ex); throw new Exceptionininitializererror (ex); } } public static Sessionfactory Getsessionfactory () { return sessionfactory; }}
Later changes to the old version number such as the following code exception disappears:
Configuration cfg = new configuration (); Sessionfactory SF = Cfg.configure (). Buildsessionfactory (); Session session = Sf.opensession ();
However, the Buildsessionfactory method is deprecated in the new version number, and finally the solution is found:
Configuration cfg = new configuration (). Configure (); sessionfactory = Cfg.buildsessionfactory (new Standardserviceregistrybuilder (). Applysettings (Cfg.getproperties ()). build ());
There is no further abnormality in the test.
[Hibernate] Access to Dialectresolutioninfo cannot is null when & #39;hibernate.dialect& #39; Not set