performance - Persistence.createEntityManager() painfully slow with Hibernate -
i'm having huge performance issues eclipse rcp application, apparently caused hibernate. more specific, application takes extremely long start (up 2 minutes) - profiling , debugging showed creating hibernate/jpa entitymanagerfactory (which happens @ startup) takes extremely long.
i've played around lot settings, such using file database rather in-memory , not using hbm2ddl, without success. has ever experienced problems these?
i'm using jdk 1.6.20, hibernate 3.5 , hsqldb 1.8 (in-memory configuration).
below persistence.xml:
<?xml version="1.0" encoding="utf-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="my_db" transaction-type="resource_local"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <!-- 20 classes; skipped brevity --> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.hsqldialect"/> <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcdriver"/> <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:my_db"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> </properties> </persistence-unit> </persistence>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
depending on how many entities have, may take time create tables, indexes , alikes. i'd change db (or non in-memory db), replace create-drop "create", run once, remove property entirely (so doesn't try create existing tables) , run again. this last step closer actual time spent hibernate current configuration.
Comments
Post a Comment