Solved

loading mapping files dynamically

Posted on 2006-11-15
3
250 Views
Last Modified: 2013-11-24
Hi,
I am using spring in the combination of hibernate. I have a lot of mapping files(*.hbm.xml) that is configured at the in the applicationContext.xml
Everything is working fine. Since all these files are loading at the startup it's consuming a lot of memory. In the development environment this is affecting very badly.
I want these files to be loaded only on demand except at the startup. How do i acheive this

Thanks,
0
Comment
Question by:seekingsolution
3 Comments
 
LVL 5

Accepted Solution

by:
kannan_ekanath earned 125 total points
ID: 17946080
In hibernate, the mapping files wont be loaded until you call
sf.buildSessionFactory() If you are using hibernate directly dont make this call until you need it.

If you are using containers such as Spring, then you can ask *Spring* to not initialise the bean until the bean is requested,

http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-lazy-init

<bean id="lazy" class="com.foo.ExpensiveToCreateBean" lazy-init="true">
    <!-- various properties here... -->
</bean>
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Jpanels and Jframe 8 32
java stored proc example 9 29
jboss wildfly 10.1 10 80
CSV file parsing thru Java 13 26
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 …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

785 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