Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

loading mapping files dynamically

Posted on 2006-11-15
3
Medium Priority
?
257 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 500 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

610 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