views:

417

answers:

1

I have a problem regarding the use of hibernate.properties and c3p0.properties. I am dependent upon an API. The API uses Hibernate. As such the API has it's own hibernate.properties and c3p0.properties file included within its delivery jar. I need to ensure I ignore these properties completely when instantiating my Hibernate SessionFactory. I do need these files to remain available on the CLASSPATH so that the API I depend upon can be configured. I simply 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 an xml configuration or setting my Hibernate properties manually. I just need to ensure that the properties in hibernate.properties and c3p0.properties are not read.

A: 

In order to do this you will have to use an XML hibernate config file. If both the hibernate.properties and hibernate.cfg.xml are present, the 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.

artgon