We have observed that during pmf.getPersistenceManager(), objectdb is creating object instances for all classes declared in package.jdo. Could You explain why? we are not even sure that in that transaction we will create instances for all classes. The number of objects created during this invocation is really huge, that causes OutOfMemory during commit (memory for jvm 1,4GB). The object network is small, it was read from file via deserialization, file has size 2MB. The data model is legacy and in default constructors it create also a lot of objects, we can not change it and we wonder what to do, we see following solution
1) switch of instance creation during getPersistenceManager() and create instances only for objects for which makePersistent is called, is it possible?
2) maybe there is posiblity to create instances not via default constructs but via clonning? it could help
moreover you have error in exception handling, bad cast is done:
java.lang.ClassCastException: java.lang.OutOfMemoryError cannot be cast to java.lang.RuntimeException