Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6177521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:17:26+00:00 2026-05-24T00:17:26+00:00

Currently doing a test-app with JCR (Modeshape). The abstracted flow is as follows: session.open,

  • 0

Currently doing a test-app with JCR (Modeshape).

  • The abstracted flow is as follows: session.open, a repository fetches on or more nodes related to a query, session.close.

  • The resulting nodes contain properties, etc. that I need to present to the view. I currently have the naive setup of letting the view take properties from the jcrNode directly. However this gives an error like: “The session with an ID of ‘e2881d98-56fd-4a57-9cce-1a7d087a11e8’ has been closed”, which makes sense.

I believe the general approach (please correct if otherwise) would be to create some sort of nodeDTO which is populated by the jcrNode when the session is still active. The view is then free to use the nodeDTO however it wants.

Now, the perfect structure for such a nodeDTO would mimic the structure of the jcrNode 1-to-1 so why not use the jcrNode as the DTO itself? This would be accomplished with something akin to hibernate detach/attach. I realize that a jcrNode (with its children) can contain lots of data, so there should likely be some parameters to determine the depth of detachment, etc.

Another approach would be to have something like the openSessionInView-pattern, although this would be mvc-framework specific.

So I can see several approaches to this, best approach first (imo):

  1. detach/attach functionality for jcrNodes
  2. good library of helper classes to create the DTOs
  3. openSessionInView

Any comments on to the ‘best-practice’ approach, etc. much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:17:27+00:00Added an answer on May 24, 2026 at 12:17 am

    Unfortunately, the JCR 2.0 specification does not define a way for the nodes to be detached from a session, so this kind of functionality would be implementation-specific.

    In lieu of a JCR method, the only technique that is agnostic of a JCR implementation would be to copy the properties and child references in a very simple structure of your own creation. Yes, that structure would at a high-level be very similar to a JCR node, but it wouldn’t need to have 90% of the methods defined on Node: a simple map of properties (by name), and a list (or ordered map) of child nodes. And by doing this, your code would be responsible for copying the nodes and subgraphs you’re interested in, so you can define the semantics to suit your needs.

    However, as the project lead for ModeShape, I do agree that detaching JCR nodes does seem like a good feature, and so I’ve logged it as an enhancement request in the ModeShape project. There are a lot of details to work out in terms of the proper semantics (especially relating to child or descendant nodes), so I’d invite you to watch that request and participate in the discussion on that issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing some user tests of my new iOS app and store some test
I am doing some simple sanity validation on various types. The current test I'm
I'm new in Silverlight and i am doing some tests. With my current test
I'm currently doing some GUI testing on a ASP.net 2.0 application. The RDBMS is
I'm currently doing the following to use typed datasets in vs2008: Right click on
i'm currently doing some reports for SSRS, and i just confirm what i already
I am currently doing IE-hacks on a website I'm working on: http://www.timkjaerlange.com/wip/co2penhagen/ I got
I am currently doing some socket programming using C/C++. To be able to use
I am currently doing a code review and the following code made me jump.
As I am currently doing this project in only C, I've up untill this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.