Changing the location of c3p0.properties and hibernate.properties
I have a problem using hibernate.properties and c3p0.properties. I am API dependent. The API uses Hibernate. So the API has its own hibernate.properties and c3p0.properties file included in its shipping jar. I need me to completely ignore these properties when instantiating the Hibernate SessionFactory. I need these files to remain available in the CLASSPATH so that the API I depend on can be configured. I just need a way to instantiate my org.hibernate.SessionFactory so that it doesn't look at these files in any way. I don't mind using xml config or setting Hibernate properties manually. I just need to make sure the properties in hibernate.properties and c3p0.properties are not read.
a source to share
You will need to use the hibernate XML config file for this. If both hibernate.properties
and are present , the hibernate.cfg.xml
XML file will override the properties file.
You can find more information here: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-xmlconfig
Note: your c3p0 properties can be defined in the same XML file.
a source to share