AnsweredAssumed Answered

[solved] Hibernate: how to get the Configuration object ?

Question asked by zomurn on Jul 8, 2009
Latest reply on Jul 9, 2009 by zomurn

I'am working with alfresco and hibernate API : I need to add extra tables to alfresco schema.
I am trying to do the classical hibernate instruction :

Configuration config = new Configuration();
       cfg = config
       "/org/alfresco/module/msc_core/activite/config/hibernate.cfg.xml" );

The problem is that alfresco already has its own application-context.xml and its own hibernate properties configuration (similar to hibernate.cfg.xml). All this hibernate configuration is initialized through spring. For example, we can read in hibernate-context.xml :

<!– load hibernate configuration properties –>    
    <bean id="hibernateConfigProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="locations">

and much more.

The problem is that file doesn't contains the REAL hibernate properties at runtime. For example the setting of hibernate.dialect may change at load time when reading in alfresco/extension in shared tomcat folder. So I'd like to be able to read and get values at runtime , when the application was completely loaded. Which spring bean contains this information ? How to get the real hibernate configuration ?