PDA

View Full Version : Jackrabbit & spring mvc: this session has been closed


davesykes
Apr 5th, 2006, 11:59 AM
Firstly, thanks for the jcr springmodule, it's making my life a lot easier.

I have been trying to get a test app going that uses a Spring MVC web front end, and Jackrabbit for the back end using the springmodules template.

I am just using the local transaction example based on the sample from springmodules.

All is going well, but when I try accessing the properties of a node in my jsp page I get
javax.jcr.RepositoryException: this session has been closed

Inside the business objects the same calls work fine.

I guess I am looking for something similar to the hibernate OpenSessionInViewFilter, is there anything like this for the jcr implementation?
If not, is the best option to create a set of transport objects that I can copy the information from the nodes/properties into and pass on to the view?

Thanks,

Dave Sykes

Costin Leau
Apr 7th, 2006, 06:21 AM
Yes - take a look at OpenSessionInViewFilter/Interceptor. It does exactly what you need - is very similar to the implementation from the orm package in the main Spring distribution.
I'm glad you find it useful.

davesykes
Apr 7th, 2006, 06:29 AM
Sorry about that, a bit obvious, not entirely sure how I managed to miss it in the javadocs.

My sample app is coming along well now though.

Thanks for the help.

Dave Sykes

davesykes
Apr 11th, 2006, 09:23 AM
Just as an update, I now have it all working using OpenSessionInViewInterceptor.

However I feel that using the Nodes and Properties directly in the view is putting some of the business logic into the view (I need to filter out the system properties) so I think I am going to go back to using transfer objects, maybe just wrapping the standard Node/Properties.

Thanks for the help, and a great system.

Dave

Costin Leau
May 12th, 2006, 04:03 PM
Your need is natural and JCR is a perfect match for some sort of ORM tool. There have been discussions on the list about that but no (usuable) framework has been released. I've tried integrating the JCR mapping which is part of the Graffito project but it's in was in a very raw state. I haven't kept track of it and I know it has been under some development but no release has been made since then.

Thanks for the positive feedback!