2014-01-09 77 views
0

合併一個LONGBLOB對象時棧是:堆內存在MySQL

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space 
    at org.hibernate.type.ByteArrayBlobType.deepCopy(ByteArrayBlobType.java:76) 
    at org.hibernate.type.ByteArrayBlobType.replace(ByteArrayBlobType.java:189) 
    at org.hibernate.type.AbstractType.replace(AbstractType.java:177) 
    at org.hibernate.type.TypeFactory.replace(TypeFactory.java:538) 
    at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:429) 
    at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:231) 
    at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:170) 
    at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:714) 
    at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:696) 
    at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:268) 
    at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:291) 
    at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:239) 
    at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:192) 
    at org.hibernate.engine.Cascade.cascade(Cascade.java:153) 
    at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:454) 
    at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:230) 
    at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:170) 
    at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:714) 
    at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:696) 
    at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:268) 
    at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:291) 
    at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:239) 
    at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:192) 
    at org.hibernate.engine.Cascade.cascade(Cascade.java:153) 
    at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:454) 
    at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:230) 
    at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:170) 
    at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:81) 
    at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:704) 
    at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:688) 
    at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:692) 
    at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:228) 

這是一個有點難以做出了巨大的代碼量來描述這個問題,但我會盡量解釋什麼我有:

我有一個對象A有一個對象B是,事實上,一個xml文件保存在Mysql分貝爲LONGBlobforeign key

因此,當我嘗試到merge(通過hibernate)對象A錯誤appreas。

我與eclipse改變JVM的內存參數嘗試:

-startup 
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar 
--launcher.library 
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807 
-product 
org.eclipse.epp.package.java.product 
--launcher.defaultAction 
openFile 
--launcher.XXMaxPermSize 
512M 
-showsplash 
org.eclipse.platform 
--launcher.XXMaxPermSize 
512m 
--launcher.defaultAction 
openFile 
-vmargs 
-Dosgi.requiredJavaVersion=1.5 
-Dhelp.lucene.tokenizer=standard 
-Xms256m 
-Xmx1024m 

我想我已經解釋了我的問題

+0

您的應用程序是運行在tomcat容器還是隻運行一個java應用程序? –

+0

在一個運行在elipse上的java應用程序中 –

回答

1

你似乎已經調整Eclipse的JVM內存設置(您正在編輯蝕。 ini文件)不是你的應用程序。您應該在Eclipse運行配置視圖中增加Java應用程序的堆大小。

而且你也應該考慮消耗高內存資源的延遲加載實體(在這種情況下是B)。