On Thu, Jul 24, 2008 at 6:50 PM, Luis Gervaso <[EMAIL PROTECTED]> wrote: > Hi, > > I'm working on jcr servlet webapp > > when we use a database backend we use on the templates (jsp or freemarker) a > disconnected dataset, that is we map the database resultset > to an arraylist of bean. > > when we use jcr, i think the real power is the data type less structure > > so what is the correct approach? > > open a session and close it in a servlet filter? working with "connected > resultset" ?
A good approach is to have one session per request (as you said, servlet filters are good to create and close a session for the request scope). Creating a session is a quick thing in Jackrabbit (with a local repository), so it is no problem to create them at different places. But if you read the properties of many nodes again and again, it is more efficient to keep the same session and remember the node objects. BTW, you can often use the Node object like a DAO, so no need to wrap them once again in most cases. Regards, Alex -- Alexander Klimetschek [EMAIL PROTECTED]
