Alexey Maslov schrieb:
>   I'd add one more question - is
> "session-per-conversation" approach suitable for
> shopping cart scenario: ShoppingCart instance lives
> for the application lifespan and persistent objects
> (say ProductItem) are added and removed? I'm asking
> because we had some problems with
> "session-per-conversation" concerning objects that did
> not have clear conversation boundaries. 
> 

I cannot clearly say, but to my knowlege you can have multiple
conversations.
The shopping cart szenario is somewhat different, because this is
clearly a case for a session scope and not a limited conversation.
So with a shopping cart you are better of with a session.merge instead
of keeping the db session open.

I only can talk as an outsider here, since I do not have any affiliation
with Seam or the jboss guys.
the way I see it the opensession in conversation is more suitable for
szenarios where you load a set of objects and then do something within
the same form or 1-2 subsequent forms, the typical crud szenario. That
way you can gain the comfort of statefulness and not having objects out
of a session during the lifetime of your use case.
But I do not see any reason to have that in a shopping cart, because
keeping a session open during the lifetime of a user session is a drain
on resources.
If you want to do that you do not have to use Seam or a dialog system
simply keep an open session in your servlet session and use that one for
all db access related stuff. But there is a reason why this approach is
not used that often.

Reply via email to