I'm using Hibernate with this SessionFactory configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="sessionFactory" scope="singleton"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<list>
<value>mappings/File1.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.current_session_context_class">thread</prop>
<prop key="cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
<prop key="show_sql">false</prop>
<prop key="hbm2ddl.auto">validate</prop>
<prop key="hibernate.c3p0.min_size">2</prop>
<prop key="hibernate.c3p0.max_size">3</prop>
<prop key="hibernate.c3p0.timeout">300</prop>
<prop key="hibernate.c3p0.max_statements">50</prop>
<prop key="hibernate.c3p0.idle_test_period">3000</prop>
</props>
</property>
</bean>
<bean id="dataSource" scope="singleton"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@127.0.0.1:1529:VIOLET" />
<property name="username" value="username" />
<property name="password" value="password" />
</bean>
It works fine until I add one more XML mapping file as follows:
<property name="mappingResources">
<list>
<value>mappings/File1.hbm.xml</value>
<value>mappings/File2.hbm.xml</value>
</list>
</property>
The added mapping "File2.hbm.xml" is not affected at all. I even try to set the class in "File2.hbm.xml" with an invalid name but there is no error shown in Hibernate (When I do that in "File1.hbm.xml", there is exception).
Could you tell me why the mapping "File2.hbm.xml" is not affected? I use Eclipse and Tomcat, does it cache some where. I already tried to clean Tomcat and restart my PC but it does not help.
Thank you in advance!
The problem is Tomcat cached the old config file. After cleaning (Server -> Clean Tomcat Work Directory), the new file takes effect.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.