• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to avoid entity binding in application startup

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all, since some months ago, i've started to develop simple applications using Hibernate. In this time i see something that i don't like, and is the fact that when you run the web application (i use netbeans), when internally entitymanager is initialized, it starts to do something like binding entities or checking if the named queries in entities are correct, and i see that because in Output window of netbeans prints something like this:



My question is, if is possible to tell hibernate not to do that, because for example, in my applications this happens when the user logins in the app so in the first login user feels that application is slow, and i don't like that.

Thanks in advance.
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont know if it is similar, But we faced similar issue when a SessionFactory object is created. I guess you can reduce the delay if you instantiate the SessionFactory or EntityManager in ServletContext listener, because it will be called during application startup, the required SessionFactory/EntityManager will be ready by the time first request arrives.

I am a novice in Hibernate hence excuse if some thing sounds stupid!
 
Oscar Calderon
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Srikanth, in my case i'm using Struts 2 so right now i initialize EntityManager from custom interceptor. You don't know if exists something in hibernate like "map the entity the first time that you use it" instead "map all the entities when entitymanager is initialized"?
 
reply
    Bookmark Topic Watch Topic
  • New Topic