Well, I overwrote HibernatePersistence.java for now... not ideal, but speeds it up by more than a factor of 2. The code needs cleaned up, but here's the idea...
Code:
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map) {
if (factory != null) {
return factory;
}
Ejb3Configuration cfg = null;
try {
ObjectInputStream in = new ObjectInputStream(new FileInputStream("/tmp/Ejb3Configuration.out"));
cfg = (Ejb3Configuration) in.readObject();
factory = cfg.buildEntityManagerFactory();
} catch (Exception e) {
// Serialized configuration not found, so build it and serialize it for next time.
try {
if (cfg == null) {
cfg = new Ejb3Configuration();
Ejb3Configuration configured = cfg.configure(info, map);
if (configured != null) {
factory = configured.buildEntityManagerFactory();
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("/tmp/Ejb3Configuration.out"));
oos.writeObject(configured);
oos.close();
}
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
return factory;
}