Is there anyway I can retrieve a DataSource that is being used by Hibernate? I need that DataSource object and pass it to an object(Apache Mahout MySqlJdbcModel)
Because this objects need a DataSource its contructor is like this
Code:
MySQLJDBCDataModel(DataSource dataSource)
However I am using Hibernate as My ORM, and the connections is being used/manage by C3P0 Connection. if necessary here is my hibernate.cfg.xml,
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/sampledb</property>
<property name="connection.username">root</property>
<property name="connection.password">mypass</property>
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="c3p0.max_size">100</property>
<property name="c3p0.min_size">1</property>
<property name="c3p0.idle_test_period">30</property>
<!-- SQL dialect -->
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<!-- Shows Generated SQL Queries By Hibernate -->
<property name="show_sql">false</property>
<!-- Drop and re-create The Database Schema on Start up -->
<property name="hbm2ddl.auto">update</property>
<property name="cache.provider.class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.connection.autocommit">true</property>
<!-- Mapping Classes -->
</session-factory>
</hibernate-configuration>
Is thre anyway I can get a DataSource that is being used by Hibernate/C3P0 and pass it to my object?