Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
JcrMappingTemplate and ObjectContentManager Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.