|
From: Colin S. <col...@ex...> - 2004-11-16 16:40:10
|
Sorry, forgot to del the <list>, that should be:
<property name="mappingLocations">
<value>/WEB-INF/**/*.hbm.xml</value>
</property>
Colin Sampaleanu wrote:
> Unless I'm missing something, that should really be
>
> <property name="mappingLocations">
> <list>
> <value>/WEB-INF/**/*.hbm.xml</value>
> </list>
> </property>
>
> if somebody is going to rely on ResourceArrayPropertyEditor. There is
> no conversion of a List to a Resource[], but rather a conversion of
> one text string, toa Resource[], via the property editor.
>
>
> jürgen höller [werk3AT] wrote:
>
>> As of Spring 1.1.2, you should also be able to use "mappingLocations"
>> (note: not "mappingResources", which just refers to classpath
>> resources) with wildcards.
>>
>> <bean id="sessionFactory"
>> class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
>> <property name="dataSource">
>> <ref local="dataSource"/>
>> </property>
>> <property name="mappingLocations">
>> <list>
>> <value>/WEB-INF/**/*.hbm.xml</value>
>> </list>
>> </property>
>> </bean>
>>
>> Actually, you can use such resource patterns on any bean property of
>> type Resource[] now (the new ResourceArrayPropertyEditor kicks in here).
>>
>> Juergen
>>
>>
>> ________________________________
>>
>> Von: spr...@li... im Auftrag
>> von Sean Brandt
>> Gesendet: Di 16.11.2004 17:15
>> An: spr...@li...
>> Betreff: Re: [Springframework-developer] using *.xml for Hibernate
>> mapping files in the spring.xml
>>
>>
>>
>> You can use the mappingDirectoryLocations to point to a location w/in
>> the classpath, I think. This works for me and the dir above it is not
>> the current working directory, but in the classpath:
>>
>> <bean id="hibernateSessionFactory"
>> class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
>> <property name="hibernateProperties">
>> <props>
>> <prop
>> key="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</prop>
>> <prop key="hibernate.use_outer_join">auto</prop>
>> <prop key="hibernate.show_sql">true</prop>
>> <prop key="hibernate.cache.provider_class">
>> com.foo.hibernate.CoherenceCacheProvider
>> </prop>
>> <prop key="hibernate.cache.use_query_cache">true</prop>
>> </props>
>> </property>
>> <property name="mappingDirectoryLocations">
>> <list>
>> <value>foo/xml/hibernate</value>
>> </list>
>> </property>
>> <property name="lobHandler">
>> <ref bean="hibernate.LobHandler"/>
>> </property>
>> </bean>
>>
>>
>> On Tue, 16 Nov 2004 15:02:32 +0000, jas...@ma...
>> <jas...@ma...> wrote:
>>
>>
>>> I'm sure I spotted someone mention a custom bean configuration thingy
>>> that could be used in your Spring.xml to fix this - but tried searching
>>> the archives and couldn't spot it.
>>>
>>> Basically I'd like to be able to do this...
>>>
>>> <bean id="sessionFactory"
>>> class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
>>> <property name="dataSource">
>>> <ref local="dataSource"/>
>>> </property>
>>> <property name="mappingResources">
>>> <list>
>>> <value>**/*.hbm.xml</value>
>>> </list>
>>> </property>
>>> </bean>
>>>
>>> rather than have to name each single mapping file by name. e.g..
>>>
>>> <property name="mappingResources">
>>> <list>
>>> <value>com/acme/model/Cheese.hbm.xml</value>
>>> <value>com/acme/model/Pizza.hbm.xml</value>
>>> <value>com/acme/model/Beer.hbm.xml</value>
>>> </list>
>>> </property>
>>>
>>> etc.
>>>
>>> Is there such a wildcard configuration thingy available right now to
>>> solve this? I'm aware of the property based
>>> PropertyPlaceholderConfigurer but wondered if anyone knew of another
>>> solution to this?
>>>
>>> James
>>> -------
>>>
>
>
|