In Spring 1.2.7, I want to inject the hibernate configuration (currently that was used to create a SessionFactory into another bean, and I'd like to do it all in the applicationContext.xml file.
I see that the configuration is available on the LocalSessionFactoryBean via getConfiguration, so I figure there is some way to get to that object.
I have the typical sessionFactory configuration:
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
<property name="mappingResources">
...
</property>
<property name="hibernateProperties"></bean>
<props>
<prop key="hibernate.query.substitutions">true=1 false=0</prop>
<prop key="hibernate.show_sql">false</prop>
...
</props>
</property>
Is there someway to access that hibernate configuration so I can inject it into another bean like the following?
<bean id="exampleNeedsHibernateConfiguration"
class="...">
<property name="configuration"><ref bean="configuration"/></property></bean>
I was thinking maybe something trick with the MethodInvokingFactoryBean might do it.
Any help is appreaciated.
Thanks,
Skip Walker


Reply With Quote