Hibernate5 uses c3p0 some small problems and attention

Recently, there have been many small errors when using Hibernate5 to configure c3p0, such as 500, org.hibernate.c3p0.internal.C3P0ConnectionProvider' is not assignable ... etc. In fact, it is the version of the jar package.

1. Introduce jar package

This jar package is located under lib\optional\c3p0 in Hibernate5


You also need to introduce the core jar package in required in Hibernate5


2. Configure c3p0

Find the location of the C3P0ConnectionProvider class, copy PATH, remember not to copy the configuration information of c3p0 used in your previous projects, everything must be based on the latest version of the jar package or development documentation, otherwise an error will occur, because the latest version of the class The location may find changes, and some IDEs will not check.


The most important part of the configuration of the new version of Hibernate 5 is configured in hibernate.cfg.xml:

<property name="hibernate.connection.provider_class">org.hibernate.c3p0.internal.C3P0ConnectionProvider</property>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324836385&siteId=291194637
Recommended