It is not exactly "our" copyObject() ... rather IBM's or Sun's.
When the EJB call returns to the calling servlet the generated WebSphere stubs do call
Code:
javax.rmi.CORBA.Util.copyObject(obj, ORB)
this in turn calls
Code:
com.ibm.CORBA.iiop.UtilDelegateImpl.copyObject(..)
and finally
Code:
com.ibm.rmi.util.ProxyUtil.copyObject(...)
This class is located inside the "ibmorb.jar" of the IBM JDK 1.4.2.
This copyObject(...) method is the place where all the time and the 500 MB are spent.
I assume this method does a "deep" copy of the object and is used to separate the object within the EJB and the returned object within the calling servlet to simulate a "remote call" within the same JVM.
We are still evaluating this, but it seems like the problem goes away, when we replace the PersistenSet and Maps inside of the object with standard HashSets and HashMaps.
Does anyone else use Hibernate inside of WebSphere 6 and calls EJBs from servlets?