Some configuration problems about the connection database of the hibernate framework

org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
This dish has been troubled by this problem for a long time when I started to learn hibernate. After google for a long time, I still have no clue. Finally, I saw some hints by chance, and finally got out of trouble! orz.

When this problem occurs, I only need to call its addClass(class) parameter after getting an instance of the configuration object (Configuratioin), which is the class type of the java class you want to map, such as:
Configuration config=new Configuration().configure( );//After obtaining the hibernate configuration object
config.addClass(Student.class);//Map the Student class to the hibernate.cfg.xml configuration file
to solve the problem, of course, you can also use hibernate5.xx or above Instead, use the 4.xx version, so that the normal configuration according to the chapter (directly use <mapping resource="" /> in hibernate.cfg.xml) will do.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326775319&siteId=291194637