|Re: [eclipselink-users] Soliciting Ideas for Dealing with Initial Entity Manager Creation Lag|
Tim Hollosy wrote:
No entities are loaded but we are very lazy and don't really do any work until you create your first EntityManager.We've begun integrating EclipseLink into an RCP business application. One interesting problem is on the fist call to createEntityManager() there is a significant lag as I assume all the Entities are loaded and other magic stuff goes on, so users aren't really expecting to have to wait the first time they do a search, or load an editor.
How about refactoring your domain model and persistence related artifacts (like persistence.xml) into a separate plugin that is eagerly loaded. The rest of your app (editors, etc.) could still be lazy? In your eager plugin I'd create an EntityManager and then close it just to force the processing of your entities (we need to examine the annotations and any mapping files) and creation of your connection pools. Also, you will probably want to dial down the number of connections in your pools to a couple. This has a big impact on startup time. I think I was doing this in the RCP example in the OSGi POC SVN branch?... One idea we had was to simply turn off lazy loading of a plugin and creating an initial entity manager in a job, then disposing it. Users are used to waiting during the initial load. One problem is if you wanted the plugins to load on startup you'd have to turn off lazy loading which uses more memory for plugins the users may not even use that session.
Back to the top