我正在从Hibernate 3 / Spring 3迁移到Hibernate 5 / Spring 4并收到此错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'sessionFactory-ETL' defined in class path resource
[config/context-hm.xml]: Error setting property values; nested
exception is org.springframework.beans.NotWritablePropertyException: Invalid
property 'eL' of bean class
[org.springframework.orm.hibernate5.LocalSessionFactoryBean]: Bean property
'eventListeners' is not writable or has an invalid setter method. Does the
parameter type of the setter match the return type of the getter?
以下是配置文件的一部分:
<bean name="hibernateEventListeners" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="pre-update" value-ref="pup" />
<entry key="save-update" value-ref="xSaS" />
<entry key="post-insert" value-ref="xIS" />
<entry key="merge" value-ref="xML" />
<entry key="pre-delete" value-ref="eRUL" />
</map>
</property>
</bean>
<bean id="sessionFactory-ETL"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="eventListeners" ref="hibernateEventListeners" />
有人可以对此有所了解吗?我不确定是否需要将hibernateEventListeners的类型更改为MapFactoryBean以外的其他类型。