简体   繁体   中英

Load hbm.xml files from different jars in webapp

I have an application which uses 2 different DAO modules(from Different JAR files) which point to same database. Since i can't use muliple dataSources here, i can't create multiple sessionFactories. I need to load hbm.xml files from these modules for my single sessionFactory.

When i try to use:

<util:list id="mappingLocations">
    <value>classpath*:**/*.hbm.xml</value>
</util:list>

i get:

Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

exception.

Could you point me in the right direction to get this working. I am using XML config.

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
    p:dataSource-ref="dataSource" p:namingStrategy-ref="namingStrategy"
    p:hibernateProperties-ref="hibernateProperties">
    <property name="mappingLocations">
        <value>classpath*:**/*.hbm.xml</value>
    </property>
</bean>

I have also tried <value> inside <list>

I had hbm with same name in both the packages. Once i removed the hbm from one package (which was mistakenly placed there) the issue got resolved.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM