我正在使用Eclipse RCP应用程序,但是遇到了严重的性能问题,似乎是由Hibernate引起的。更具体地说,应用程序启动需要非常长的时间(长达2分钟)-分析和调试显示创建Hibernate/JPA EntityManagerFactory(在启动时发生)需要非常长的时间。
我已经尝试了许多设置,例如使用文件数据库而不是内存数据库,不使用hbm2ddl等,但没有成功。是否有人曾经遇到过这样的问题?
我正在使用JDK 1.6.20、Hibernate 3.5和HSQLDB 1.8(内存配置)。
以下是我的persistence.xml文件:
我已经尝试了许多设置,例如使用文件数据库而不是内存数据库,不使用hbm2ddl等,但没有成功。是否有人曾经遇到过这样的问题?
我正在使用JDK 1.6.20、Hibernate 3.5和HSQLDB 1.8(内存配置)。
以下是我的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>