On Mon, 3 Oct 2011 10:31:38 +0200
Martin Grigorov <[email protected]> wrote:


> > Yes, just put a field in your Session and add getter/setter.
> This is not good.
> This is error prone. This way you'll have to keep the instance in the
> Session in sync with the data DB. Additionally the memory size will
> increase for no reason. Select by primary key (user id) is fast
> operation.

That depends on what you're doing. One possibility is that it's mostly
read-only data, then it can be a speed boost to just keep that stuff in
the session.

Of course, if you have writes all over the place, then that could
become messy. An alternative could be a model implementation that reads
from the session and updates both session and DB on a write. That would
basically be a cache then.

Selecting by user id is *probably* fast, but it depends on what other
data needs to be joined to it. It might also be a more costly operation.

Carl-Eric
www.wicketbuch.de

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to