I'm looking into performance problems for my application and found an oddity that I need help corrected. We have a POJO class that mapped to a database table that, in its basic constructor, does some initialization to the class. This initialization is fairly cheap; however, hibernate is creating thousands of proxy objects that subclass my POJO during operation, and, subsequently, is executing my initialization code too often, making it a performance problem.
So I seek to understand how I can reduce the number of proxy objects being created by hibernate:
I call add to a hibernate managed persistent set once:
org.hibernate.collection.PersistentSet.add(Object)...beneath it initializeEntity() is being called thousands of times (11,807 times)...this leads to the creation of proxy objects to my POJO thousands of times. The constructor for the generated proxy object is called the 11,807 times.
...
org.hibernate.collection.PersistentSet.add(Object) 169,753 ms Called 1 time
leads to
org.hibernate.engine.TwoPhaseLoad.initializeEntity(Object, boolean, SessionImplementor, PreLoadEvent, PostLoadEvent)
93,984ms Called 11,807 times
which leads to
com.gaic.uwd.core.dataaccess.beans.Quote$$EnhancerByCGLIB$$34910fb6.<init>()
76,562ms Called 11,807 times
Thanks,
jsfguy1234
|