?
Solved

spring hibernate mappingDirectoryLocations

Posted on 2011-05-06
6
Medium Priority
?
1,995 Views
Last Modified: 2012-05-11
I was reading folowing lines. And I did not understand clearly.

 if your application grows and you have dozens, if not hundreds, of persistent
classes? It would be cumbersome to configure them all in this fashion.
Fortunately, Spring offers you an alternative. You can also configure the mapping-
DirectoryLocations property with a path that is a subset of your application’s
class path, and Spring will configure the SessionFactory with every *.hbm.xml it
finds in this path. For example, assuming that all the persistent classes we want to
configure are contained in the com.springinaction.training.model package, we
would configure our SessionFactory like this:
<bean id="sessionFactory" class="org.springframework.
orm.hibernate.LocalSessionFactoryBean">
<property name="mappingDirectoryLocations">
<list>
<value>classpath:/com/springinaction/training/model</value>
</list>
</property>

</bean>


what mappingDirectoryLocations does and how it is used.
Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
0
Comment
Question by:gudii9
  • 4
  • 2
6 Comments
 
LVL 92

Expert Comment

by:objects
ID: 35710945
It allows you to specify a directory containing your hbm's, and it will load up all hbms in that dirwctory
saves you having to specify them individually
0
 
LVL 7

Author Comment

by:gudii9
ID: 35725116
>><bean id="sessionFactory" class="org.springframework.
orm.hibernate.LocalSessionFactoryBean">


sessionFactory is hibernate class right. Why are we referring it through spring
>>class="org.springframework.
orm.hibernate.LocalSessionFactoryBean


please advise
0
 
LVL 92

Expert Comment

by:objects
ID: 35725137
no, its a spring class
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 92

Expert Comment

by:objects
ID: 35725143
is a spring factory bean that creates hibernate SessionFactory's
0
 
LVL 7

Author Comment

by:gudii9
ID: 35725164
>>is a spring factory bean that creates hibernate SessionFactory's

same session factory class is both there in spring and hibernate which are different classes. But pring factory bean that creates and  hibernate SessionFactory class right. Am i am right. please advise
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 35725176
yes the spring factory bean creates hibernate SessionFactory's
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month15 days, 11 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question