I am migrating a combination of 'Spring 2.5.2 + Hibernate 3.2.6' to 'Spring 3.0.3 + Hibernate 3.6.5'.
I see some problems in my configuraions when Spr-3.0.3 + Hib-3.6.5 is used. I am unable to use 'filterDefinitions' properly as it throws NoSuchMethodError error. A part of the xml that throws exception would be as below
Exception stack-trace:Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"> ------------------------------------- <bean id="sessionFactory" class="CustomAnnotationSessionFactoryBean" lazy-init="true"> ----- <property name="annotatedClasses"> <list> <value>CLASS1</value> <value>CLASS2</value> <value>CLASS3</value> </list> </property> <property name="mappingResources"> <list> <value>types.hbm.xml</value> </list> </property> <property name="filterDefinitions"> <list> <bean class="org.springframework.orm.hibernate3.FilterDefinitionFactoryBean"> <property name="filterName" value="myFilter"/> <property name="parameterTypes"> <props> <prop key="id">int</prop> </props> </property> </bean> </list> </property> </bean> ------- </beans>
The reason I see this, could be because of the heuristicType method which is moved from TypeFactory to TypeResolver class in Hibernate 3.6.5.Code:Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'parameterTypes' threw exception; nested exception is java.lang.NoSuchMethodError: org.hibernate.type.TypeFactory.heuristicType(Ljava/lang/String;)Lorg/hibernate/type/Type; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
Now my questions on this would be as below:
1) Are Spring-3.0.3 + Hibernate-3.6.5 versions compatible? If not, which compatible version of Spring should be used with Hibernate-3.6.5?
2) Is there any alternative that could be used for 'filterDefinitions' in my xml?
If anyone know a fix for this, please do reply back. Appreciate your help.
Thanks.


Reply With Quote