Hibernate first start Make application slow
I use Hibernate for my desktop swing applications.The first database access makes the application开发者_StackOverflow中文版 slow,not responding.I think it is because the hibernate's libraries takes time to load.This problem occurs specially at the loging.it takes time to go from loging page to home page(It makes the user unpleasant). Any one tell me how to avoid this slowness please.
This article is about NHibernate but it might be worth trying:
- merging hbm files into one
- initializing session factory on a background thread
- have two session factories, one as fast 'initialization' session that only contains entities needed during initialization and put the rest entities into another
The slow part of Hibernate is buliding the SessionFactory. Make sure you only do it once, and get it done before the user needs to interact with the database. Your problem should go away then.
精彩评论