Hibernate 6.0.0.Alpha9 cannot resolve c3p0 DriverManagerDataSource

Issue

I have been experimenting with updating Hibernate to 6.0.0 Alpha9 version from Hibernate 5 when I got the message that both hibernate-core and hibernate-c3p0 are being relocated from org.hibernate to org.hibernate.orm. But as I do that in my Spring MVC configuration class import com.mchange.v2.c3p0.DriverManagerDataSource; becomes unresolved. Was it removed from the new version or do I need to use something else instead?

I currently use it as a DataSource for Spring Security and Liquibase:

    @Bean(name = "dataSource")
    public DriverManagerDataSource dataSource() {
        DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource();
        driverManagerDataSource.setDriverClass( dataSourceDriverClass );
        driverManagerDataSource.setJdbcUrl( dataSourceUrl );
        driverManagerDataSource.setUser( dataSourceUsername );
        driverManagerDataSource.setPassword( dataSourcePassword );
        return driverManagerDataSource;
    }

Solution

The dependency structure seems to have changed i.e. the dependency is not exposed transitively anymore. You will have to add an explicit dependency api 'com.mchange:c3p0:0.9.5.5' or

<dependency>
  <groupId>com.mchange</groupId>
  <artifactId>c3p0</artifactId>
  <version>0.9.5.5</version>
</dependency>

Answered By – Christian Beikov

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published