|
From: <jue...@we...> - 2004-11-16 16:28:16
|
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.
=20
<bean id=3D"sessionFactory" =
class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name=3D"dataSource">
<ref local=3D"dataSource"/>
</property>
<property name=3D"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).
=20
Juergen
=20
________________________________
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=3D"hibernateSessionFactory"
class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name=3D"hibernateProperties">
<props>
<prop
key=3D"hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</prop>
<prop key=3D"hibernate.use_outer_join">auto</prop>
<prop key=3D"hibernate.show_sql">true</prop>
<prop key=3D"hibernate.cache.provider_class">
com.foo.hibernate.CoherenceCacheProvider
</prop>
<prop =
key=3D"hibernate.cache.use_query_cache">true</prop>
</props>
</property>
<property name=3D"mappingDirectoryLocations">
<list>
<value>foo/xml/hibernate</value>
</list>
</property>
<property name=3D"lobHandler">
<ref bean=3D"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=3D"sessionFactory"
> class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean">
> <property name=3D"dataSource">
> <ref local=3D"dataSource"/>
> </property>
> <property name=3D"mappingResources">
> <list>
> <value>**/*.hbm.xml</value>
> </list>
> </property>
> </bean>
>
> rather than have to name each single mapping file by name. e.g..
>
> <property name=3D"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
> -------
> http://radio.weblogs.com/0112098/
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: InterSystems CACHE
> FREE OODBMS DOWNLOAD - A multidimensional database that combines
> robust object and relational technologies, making it a perfect match
> for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
--
Sean Brandt
<sea...@gm...>
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: <jue...@we...> - 2004-11-16 16:48:09
|
Well-spotted, Colin - it needs to be a plain value, not part of a list.
=20
Juergen
=20
________________________________
Von: spr...@li... im Auftrag =
von Colin Sampaleanu
Gesendet: Di 16.11.2004 17:39
An: spr...@li...
Betreff: Re: [Springframework-developer] using *.xml for Hibernate =
mapping files in the spring.xml
Sorry, forgot to del the <list>, that should be:
<property name=3D"mappingLocations">
<value>/WEB-INF/**/*.hbm.xml</value>
</property>
Colin Sampaleanu wrote:
> Unless I'm missing something, that should really be
>
> <property name=3D"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=FCrgen h=F6ller [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=3D"sessionFactory"
>> class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean">
>> <property name=3D"dataSource">
>> <ref local=3D"dataSource"/>
>> </property>
>> <property name=3D"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=3D"hibernateSessionFactory"
>> class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean">
>> <property name=3D"hibernateProperties">
>> <props>
>> <prop
>> =
key=3D"hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</prop>
>> <prop key=3D"hibernate.use_outer_join">auto</prop>
>> <prop key=3D"hibernate.show_sql">true</prop>
>> <prop key=3D"hibernate.cache.provider_class">
>> com.foo.hibernate.CoherenceCacheProvider
>> </prop>
>> <prop =
key=3D"hibernate.cache.use_query_cache">true</prop>
>> </props>
>> </property>
>> <property name=3D"mappingDirectoryLocations">
>> <list>
>> <value>foo/xml/hibernate</value>
>> </list>
>> </property>
>> <property name=3D"lobHandler">
>> <ref bean=3D"hibernate.LobHandler"/>
>> </property>
>> </bean>
>>
>>
>> On Tue, 16 Nov 2004 15:02:32 +0000, jas...@ma...
>> <jas...@ma...> wrote:
>>=20
>>
>>> 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=3D"sessionFactory"
>>> class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean">
>>> <property name=3D"dataSource">
>>> <ref local=3D"dataSource"/>
>>> </property>
>>> <property name=3D"mappingResources">
>>> <list>
>>> <value>**/*.hbm.xml</value>
>>> </list>
>>> </property>
>>> </bean>
>>>
>>> rather than have to name each single mapping file by name. e.g..
>>>
>>> <property name=3D"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
>>> -------
>>>
>
>
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: Oliver H. <Ol...@ou...> - 2004-11-17 04:21:53
|
Actually this may be fixed some time soon, I just uploaded a patch to Jira which allows for wildcard matching regardless of whether the files are in a jar or on the file system. I've not tested it with jars inside jars (WARs, EARs etc..) so that could be a problem, but, as long as a JarURLConnection handler that supports nested jars is installed, I can't see why my patch would not work. So hopefully soon you'll be able to have: <property name=3D"mappingDirectoryLocations"> <value>classpath:/hibernate/*.hbm.xml</value> </property> or <property name=3D"mappingDirectoryLocations"> <value>classpath*:/hibernate/*.hbm.xml</value> </property> Ollie > -----Original Message----- > From: spr...@li...=20 > [mailto:spr...@li...] > On Behalf Of Colin Sampaleanu > Sent: Wednesday, 17 November 2004 3:22 AM > To: spr...@li... > Subject: Re: [Springframework-developer] using *.xml for=20 > Hibernate mapping files in the spring.xml >=20 >=20 > Just keep in mind that pointint to a classpath location, with any=20 > wildcarding, will break when the app is deployed such that=20 > the files are=20 > actually not on the physical filesystem. For example,=20 > WebLogic will not=20 > expand the entire contents of a WAR or EAR to the filesystem, relying=20 > instead on a specialized URL handler to get resources directly from=20 > within the archive. There's nothing that Spring can do about that=20 > particular situation... >=20 >=20 > Sean Brandt wrote: >=20 > >You can use the mappingDirectoryLocations to point to a=20 > location w/in=20 > >the classpath, I think. This works for me and the dir above=20 > it is not=20 > >the current working directory, but in the classpath: > > > > <bean id=3D"hibernateSessionFactory"=20 > >class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean"> > > <property name=3D"hibernateProperties"> > > <props> > > <prop=20 > >key=3D"hibernate.dialect">net.sf.hibernate.dialect.Oracle9Diale > ct</prop> > > <prop key=3D"hibernate.use_outer_join">auto</prop> > > <prop key=3D"hibernate.show_sql">true</prop> > > <prop key=3D"hibernate.cache.provider_class"> > > com.foo.hibernate.CoherenceCacheProvider > > </prop> > > <prop=20 > key=3D"hibernate.cache.use_query_cache">true</prop> > > </props> > > </property> > > <property name=3D"mappingDirectoryLocations"> > > <list> > > <value>foo/xml/hibernate</value> > > </list> > > </property> > > <property name=3D"lobHandler"> > > <ref bean=3D"hibernate.LobHandler"/> > > </property> > > </bean> > > > > > >On Tue, 16 Nov 2004 15:02:32 +0000, jas...@ma...=20 > ><jas...@ma...> wrote: > > =20 > > > >>I'm sure I spotted someone mention a custom bean=20 > configuration thingy=20 > >>that could be used in your Spring.xml to fix this - but tried=20 > >>searching the archives and couldn't spot it. > >> > >>Basically I'd like to be able to do this... > >> > >> <bean id=3D"sessionFactory"=20 > >>class=3D"org.springframework.orm.hibernate.LocalSessionFactoryBean"> > >> <property name=3D"dataSource"> > >> <ref local=3D"dataSource"/> > >> </property> > >> <property name=3D"mappingResources"> > >> <list> > >> <value>**/*.hbm.xml</value> > >> </list> > >> </property> > >> </bean> > >> > >>rather than have to name each single mapping file by name. e.g.. > >> > >> <property name=3D"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=20 > right now to=20 > >>solve this? I'm aware of the property based=20 > >>PropertyPlaceholderConfigurer but wondered if anyone knew=20 > of another=20 > >>solution to this? > >> > >>James > >>------- > >>http://radio.weblogs.com/0112098/ > >> > >>------------------------------------------------------- > >>This SF.Net email is sponsored by: InterSystems CACHE > >>FREE OODBMS DOWNLOAD - A multidimensional database that combines=20 > >>robust object and relational technologies, making it a=20 > perfect match=20 > >>for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8=20 > >>_______________________________________________ > >>Springframework-developer mailing list=20 > >>Spr...@li... > >>https://lists.sourceforge.net/lists/listinfo/springframework -developer >> >> =20 >> > > > =20 > ------------------------------------------------------- This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8 _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Colin S. <col...@ex...> - 2004-11-16 16:39:18
|
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
>>-------
>>
|
|
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
>>> -------
>>>
>
>
|