|
From: <jas...@ma...> - 2004-11-16 15:02:37
|
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
-------
http://radio.weblogs.com/0112098/
|
|
From: Ugo C. <u....@cb...> - 2004-11-16 15:53:06
|
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>
Try this:
<property name="mappingDirectoryLocations">
<list>
<value>classpath:</value>
</list>
</property>
HTH,
Ugo
|
|
From: <jas...@ma...> - 2004-11-16 16:04:08
|
Fantastic! Many many thanks Ugo. I was sure there just had to be a cleaner way of doing it! :) I'd been scratching my head quite a bit over that one & couldn't see the wood for the trees - thanks again! On 16 Nov 2004, at 15:52, Ugo Cei wrote: > 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> > > Try this: > > <property name="mappingDirectoryLocations"> > <list> > <value>classpath:</value> > </list> > </property> > > HTH, > > Ugo > James ------- http://radio.weblogs.com/0112098/ |
|
From: Sean B. <sea...@gm...> - 2004-11-16 16:15:41
|
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
> -------
> 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...>
|
|
From: Colin S. <col...@ex...> - 2004-11-16 16:22:03
|
Just keep in mind that pointint to a classpath location, with any wildcarding, will break when the app is deployed such that the files are actually not on the physical filesystem. For example, WebLogic will not expand the entire contents of a WAR or EAR to the filesystem, relying instead on a specialized URL handler to get resources directly from within the archive. There's nothing that Spring can do about that particular situation... Sean Brandt wrote: >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 >>------- >>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 >> >> >> > > > > |