Nodes / Session

View: New views
2 Messages — Rating Filter:   Alert me  

Nodes / Session

by Luis Gervaso :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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" ?

thanks

luis

--
-------------------------------------------
Luis Alberto Gervaso Martin
Java EE Architect & Instructor
C/ Cuenca 4A, 2ºB
Getafe (Madrid)
SPAIN
mobile: (+34) 627983344
luis.gervaso@...

Re: Nodes / Session

by Alexander Klimetschek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 24, 2008 at 6:50 PM, Luis Gervaso <luis.gervaso@...> 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
alexander.klimetschek@...
LightInTheBox - Buy quality products at wholesale price