Q:

Out of memory when using Hibernate save a large rescord?

My project parse XML file from dblp , it about 1GB to save in ORM database, so I use SAXP for reading information like (paper'author, paper'infomation ......).
The function reading is OK but when I using hibernate to save information to database it have error: "java.lang.OutOfMemoryError: Java heap space "

A:

From the stack trace  , it seems that the java.lang.OutOfMemoryError is not due to Hibernate because  it happens when the SessionFactory is built. 
I think it is due to the big size XML you are parsing . You can verify it by parsing a smaller XML. If it can be saved , you can isolate the problem is not caused by Hibernate .
You can increase the maximum heap size of your Vm by using the -Xmx parameter , for example:
java -Xmx2048m 

