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 “
From the stack trace , it seems that the
java.lang.OutOfMemoryErroris not due to Hibernate because it happens when theSessionFactoryis 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: