Solved

loading mapping files dynamically

Posted on 2006-11-15
3
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

705 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