Persistence.createEntityManager () painfully slow with Hibernate

I'm having big performance issues with my Eclipse RCP application, which is apparently caused by Hibernate. To be more specific, the application takes a very long time (up to 2 minutes) - profiling and debugging showed that creating a Hibernate / JPA EntityManagerFactory (what happens at startup) takes a lot of time.

I played a lot with settings, for example, using a file database, and not in memory, and did not use hbm2ddl, but to no avail. Has anyone ever encountered such problems?

I am using JDK 1.6.20, Hibernate 3.5, and HSQLDB 1.8 (in memory).

Below is my 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>
            <!-- about 20 classes; skipped for 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>
+3
source share
2 answers
        <property name="hibernate.hbm2ddl.auto" value="create-drop"/>

, , , . DB ( db), create-drop "create", , ( ) . , Hibernate, .

+1

-. hibernate persistence.xml xml. , - xsd . , ?

0

Source: https://habr.com/ru/post/1792877/


All Articles