Hi I have a burning question regarding OutOfMemoryErrors when turning LazyLoading on. When lazyloading is off, everything runs ok. So i reckon it must have something to do with this CGLIB stuff
I have searched through this whole forum for a solution and have tried the things suggested (see below) but to no avail.
I've built a code generator that generates hibernate POJOS and the mappings from reading the db metadata.
this generator created a total of 1400 entities from 2 databases, with no collections. which are all correct.
these entities are then used as a db layer for a data replication tool i'm building. it copies data from one db to another (with some transformation of data)
but i keep getting OutOfMemoryErrors.
i've tried these things:
setting hibernate.cglib.use_reflection_optimizer to false in the system properties, but when debugging i can still see the CGLIBenhanced classes on some many-to-one properties
I serialized the ConfigurationObject
I call session.clear() on each commit
I call session.flush() on each commit
Instrumenting the classes just made things worst, it couldn't get past the cfg.buildSessionFactory()
Setting the heap size to 1024 doesn't work (when looking at (VM)Memory in my taskmanager, it doesn't get near 1024 before throwing this outofMemoryError). the tool dies when 390 MB is reached
Nothing i did above had any effect.
the only thing that worked, was turning lazyloading off, but that generated a monster sql statement for entities with lots of outgoing references
I'm not using Tomcat or anything, I've implemented a workmanager api to run the tool concurrently. So no (re)deployment is needed.
So what else can i do?
Please any help would be appreciated
Hibernate version: 3.1.3
|