Hi, This occurs because the entire Aries JPA container is as lazy as possible, we don't create an EntityManager until the first time the service is used. If the EntityManagerFactory hasn't been used before then OpenJPA can take a while to create the EntityManager. All I can suggest is that you create an init method on your blueprint bean that performs a simple operation on the EntityManager to get this wait out of the way before a user hits it.
Any real improvements would need to be made in OpenJPA to reduce startup time. It's possible that you can speed things up by specifying properties directly so that OpenJPA doesn't have to autodetect the database type. Also are you attempting to do runtime table generation? I'm afraid I can't offer much more assistance than to copy this email on to the OpenJPA list and hope that they can provide some insight. Regards, Tim ________________________________ > Date: Thu, 24 Feb 2011 09:19:54 +0800 > Subject: OpenJPA starting up blocks thread > From: [email protected] > To: [email protected] > > Hi > > I'm not sure this related to blueprint or openjpa. > > The problem is when you first time accessing the database , > The openjpa try to init and I got the message: > 7205 XXXUnit INFO [Gogo shell] openjpa.Runtime - Starting OpenJPA 2.0.1 > 7303 XXXUnit INFO [Gogo shell] openjpa.jdbc.JDBC - Using dictionary > class "org.apache.openjpa.jdbc.sql.DerbyDictionary". > > And this process takes some time and blocks the thread. > It unpleasant to the user and sometimes I get a timeout behaviour for > the EventAdmin. > > So how could I force OpenJPA init itself when the OSGi framework startup? > > Thanks > LongkerDandy
