-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Getting a DataSource that is being used by Hibernate.
PostPosted: Wed May 01, 2013 10:29 am 
Newbie

Joined: Wed May 01, 2013 9:45 am
Posts: 1
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.