`
kevinhrw
  • 浏览: 187555 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Cannot cache an unknown entity: java.runtime.name

阅读更多

将Spring2.5的Jar包换成3.2以后hibernate出现异常 Invocation of init method failed; nested exception is org.hibernate.MappingException: Cannot cache an unknown entity: java.runtime.name


我的应该是Cache配置出错了。把下面CODE加上就OK了。

<property name="entityCacheStrategies">
			<props>
				</props>
				</property>
					<property name="collectionCacheStrategies">
				<props>
			</props>
		</property>
		<property name="configurationClass">
            <value>org.hibernate.cfg.AnnotationConfiguration</value>
        </property>

 

完整的sessionFactory

<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="configLocation"
			value="classpath:/hibernate.cfg.xml" />
		<property name="mappingLocations">
			<list>
				<value>classpath*:jbpm.repository.hbm.xml</value>
	            <value>classpath*:jbpm.execution.hbm.xml</value>
	            <value>classpath*:jbpm.history.hbm.xml</value>
	            <value>classpath*:jbpm.task.hbm.xml</value>
	            <value>classpath*:jbpm.identity.hbm.xml</value>
			</list>
		</property>

		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					${hibernate.dialect}
				</prop>
				<prop key="hibernate.show_sql">
					${hibernate.show_sql}
				</prop>
				<prop key="hibernate.cache.use_query_cache">
					${hibernate.cache.use_query_cache}
				</prop>
				<prop key="hibernate.cache.provider_class">
					${hibernate.cache.provider_class}
				</prop>
				<prop
					key="hibernate.cache.provider_configuration_file_resource_path">
					${hibernate.cache.provider_configuration_file_resource_path}
				</prop>
				<prop key="hibernate.cache.use_second_level_cache">
					${hibernate.cache.use_second_level_cache}
				</prop>
				<prop key="hibernate.use_sql_comments">
					${hibernate.use_sql_comments}
				</prop>
				<prop key="hibernate.format_sql">
					${hibernate.format_sql}
				</prop>
				<prop key="hibernate.default_schema">${jdbc.schema}</prop>
			</props>
		</property>
		<property name="entityCacheStrategies">
			<props>
				</props>
				</property>
					<property name="collectionCacheStrategies">
				<props>
			</props>
		</property>
		<property name="configurationClass">
            <value>org.hibernate.cfg.AnnotationConfiguration</value>
        </property>
		<property name="eventListeners">
			<map>
				<entry key="merge">
					<bean
						class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
				</entry>
			</map>
		</property>
	</bean>
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics