Jun 10th, 2009, 11:10 AM
JcrMappingTemplate and ObjectContentManager
I am looking through the JcrMappingTemplate code trying to get a good understanding of how the code works. One thing that I noticed is that it appears that a new ObjectContentManager is created for each jcr action.
In the execute(final JcrMappingCallback action, boolean exposeNativeSession) method of the JcrMappingTemplate, the doInJcrMapping method creates a new ObjectContentManager. Does it create a new OCM for each execution of the parent execute() method?
It would seem like there should be a way to create an OCM during initialization and just pass in a new session for each JCR query. I did a very basic performance test comparing using the JcrMappingTemplate using the doInJcr() methods versus just doing the query outside of the doInJcr() method and my results showed that not using the doInJcr() method was a lot faster. So I am guessing that creating a new OCM for each request is taking up a lot of time.