我正在使用JavaEE7,hibernate-jpa2.1
我的项目有太多实体(大约2000个实体)
如果它只有100个对象实体,它启动正常。
但是现在我已经添加了我所有的业务实体类(2000)并且我得到了一个 pergem 空间错误。
2016-12-29T11:40:36.903+0700|Severe: Exception in thread "DynamicReloader"
2016-12-29T11:40:36.904+0700|Severe: java.lang.OutOfMemoryError: GC overhead limit exceeded
2016-12-29T11:40:37.899+0700|Severe: Exception in thread "AutoDeployer"
2016-12-29T11:40:37.900+0700|Severe: java.lang.OutOfMemoryError: GC overhead limit exceeded
我已经改进了 jvm 内存参数,但现在我的应用程序在启动过程中非常慢。
那么,我会知道是否有一些选项可以更快地加载这些实体?预先感谢
这是示例实体
@Entity
@Table(name = "TBL_USER")
@NamedQueries({
@NamedQuery(name = "TblUserO.findAll", query = "SELECT t FROM TblUserO t")
})
public class TblUserO implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "USER_ID", unique = true, nullable = false, precision = 11)
private Long userId;
持久性.xml
<persistence-unit name="c1spostgre1" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>jdbc/__PSG1</jta-data-source>
<!-- Named JPQL queries per entity, but any other organization is possible -->
<properties>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform"/>
<property name="hibernate.enable_lazy_load_no_trans" value="true"/>
<!-- <property name="hibernate.archive.autodetection" value="class" /> -->
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL92Dialect" />
<property name="hibernate.jdbc.batch_size" value="20" />
<property name="hibernate.order_updates" value="true"/>
<property name="hibernate.order_inserts" value="true"/>
</properties>
</persistence-unit>
<persistence-unit name="c1spostgre2" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>jdbc/__PSG2</jta-data-source>
<properties>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform"/>
<property name="hibernate.enable_lazy_load_no_trans" value="true"/>
<!-- <property name="hibernate.archive.autodetection" value="class" /> -->
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL92Dialect" />
<property name="hibernate.jdbc.batch_size" value="20" />
<property name="hibernate.order_updates" value="true"/>
<property name="hibernate.order_inserts" value="true"/>
</properties>
</persistence-unit>