How the hibernate selects ojdbc jars if multiple jars are available?

We have 4 ojdbc jars namely ojdbc14.jar, ojdbc6.jar, ojdbc7.jar and ojdbc8.jar in the “lib” folder of the java application. And we have declared the necessary configurations for the driver in XML file as shown below,

<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />           

In the above options, Which ojdbc jar does hibernate choose? whether it will select the first jar or will select one of the ojdbc jars at random.

And based on what logic does Hibernate select the appropriate ojdbc jar file?

Thanks in advance.

It’s not the task of Hibernate to “select JARs”, it is the task of the Java ClassLoader to decided from which JAR to load a request class from. Usually, the class path is ordered in some way and it will load the class from the first JAR in which it finds the class, but ultimately, you should simply remove JARs from the classpath that contain duplicate/same-named class files.