cheetah100
May 5th, 2009, 06:22 PM
I have an application currently working as a Spring app in a single ApplicationContext, which has a LocalSessionFactoryBean bean defined which is then used later in data access objects and provided to other beans as a reference within a property. However, when I create a bundle and try the same thing - I get a "could not be converted to the required type 'interface org.hibernate.SessionFactory'" error.
<bean id="hibernateSession" class="org.springframework.orm.hibernate3.LocalSessionFac toryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.default_schema">core</prop>
<prop key="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</prop>
<prop key="hibernate.connection.release_mode">after_statement</prop>
</props>
</property>
</bean>
<bean id="process.catalogueProcess" class="xxx.GenericCaptureProcess">
<property name="inBeanName" value="catalogueDTO"/>
<property name="outBeanName" value="catalog"/>
<property name="assemblyName" value="assembly/product.xml"/>
<property name="sessionFactory" ref="hibernateSession"/>
<property name="sender" ref="sender"/>
</bean>
In this example the process.catalogueProcess receives the sessionFactory successfully. When running under DM Server however the startup will fail and I get a message:
The property value 'org.springframework.orm.hibernate3.LocalSessionFa ctoryBean@193bf6c8', specified in the definition of bean 'process.catalogueProcess', could not be converted to the required type 'interface org.hibernate.SessionFactory'.
Any ideas about whats going on here?
<bean id="hibernateSession" class="org.springframework.orm.hibernate3.LocalSessionFac toryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.default_schema">core</prop>
<prop key="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</prop>
<prop key="hibernate.connection.release_mode">after_statement</prop>
</props>
</property>
</bean>
<bean id="process.catalogueProcess" class="xxx.GenericCaptureProcess">
<property name="inBeanName" value="catalogueDTO"/>
<property name="outBeanName" value="catalog"/>
<property name="assemblyName" value="assembly/product.xml"/>
<property name="sessionFactory" ref="hibernateSession"/>
<property name="sender" ref="sender"/>
</bean>
In this example the process.catalogueProcess receives the sessionFactory successfully. When running under DM Server however the startup will fail and I get a message:
The property value 'org.springframework.orm.hibernate3.LocalSessionFa ctoryBean@193bf6c8', specified in the definition of bean 'process.catalogueProcess', could not be converted to the required type 'interface org.hibernate.SessionFactory'.
Any ideas about whats going on here?