NHibernate in Action: Long running conversations

62 views
Skip to first unread message

Tobes

unread,
Jun 20, 2008, 6:16:53 AM6/20/08
to nhusers
Hi folks

I just wanted to elicit the opinions of the NHibernate users out there
- I'm currently helping Pierre Henri Kuate with the book, and and
found something that surprised me in Chapter 10 regarding long running
conversations.

I've put this question to Pierre Henri:

"I'm working on Chapter 10 today (almost done!), and wanted to check
something with you.

As in the original Hibernate book, it states that the "hard way" to do
long running conversations is to reload data on each request.

Of all the patterns, this "hard way" is probably my favourite, mainly
because it's so simple! I've tried session per conversation before,
but don't like it for several reasons (having to handle multiple/
duplicate conversations, stale data, consuming valuable web session
resources, handling web session lifecycle etc). I also had similar
complexities with keeping detached objects, although it was more
manageable.

I appreciate I probably just had bad experiences here, so I'm probably
wrong! Would be good to get your thoughts on this, and any good
experiences with detatched objects and session-per-conversation?"

Can anyone enlighten me on this one?

Tobin

Ayende Rahien

unread,
Jun 20, 2008, 7:24:37 AM6/20/08
to nhu...@googlegroups.com
It is much easier to work with session per request.
The use of session per conversation really shine in WinForm apps, where you may have a long conversation about something there.

Fabio Maulo

unread,
Jun 20, 2008, 9:51:30 AM6/20/08
to nhu...@googlegroups.com
Tobes!!! at the end we can know you ;)
I know about your work in NHiA... I'm waiting it since long time ;).

Well...
Like you said session-per-conversation is not easy to implement and sometimes is expensive from the point of view of an httpSession.
BTW there are some webApp that need it, or better, in some app session-per-conversation is the only one solution.
I know one app, for an intranet, where the amount of complex-UseCase and complex-business-transactions are much more than simple; there, reload data on each request from tempTables was not the option so... no option than session-per-conversation.

"The home" offert a green solution (green mean NOT mature). The main target of NHibernate.Burrow (core) project is the management of session-per-conversation in complex webApp environment. We would like to have a shared solution for WinForm too (in NHibernate.Contrib project there are some good soul working on it).
http://sourceforge.net/projects/nhcontrib

There are some others good implementations available in Castle and Spring.
http://www.castleproject.org/container/facilities/v1rc3/nhibernate/index.html

I think that what the book said about session-per-conversation is enough... people must know that the solution exists even if it is not so easy to implement.

Happy to read you.
Bye.
Fabio Maulo.

James Kovacs

unread,
Jun 20, 2008, 10:57:39 AM6/20/08
to nhu...@googlegroups.com
I'm with Fabio and Oren on this one. Session-per-request is much easier to implement and scale. That should be your default for a web-based application. That said, developers should know that session-per-conversation exists in case they need it.

James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP - C# Architecture
http://www.jameskovacs.com
jko...@post.harvard.edu
403-397-3177 (mobile)

Tobes

unread,
Jun 20, 2008, 11:34:19 AM6/20/08
to nhusers
Thanks guys

Based on the responses, and if Pierre Henri agrees, I'd like to change
the books default recommendation from session-per-conversation to
session-per-request. I've also penciled in a mention of the Burrows
project with relation to session-per-conversation. That said, I should
take a closer look, but the home page was down last time I checked.

@Fabio
Nice to meet you too, hopefully not too long for the book now :)

@James
Thanks for the vote. I thought your name was familiar, I've been
following your blog for ages. If I wasn't on a Mac I'd have built your
Ultimate Rig by now!

Tobin

On Jun 20, 3:57 pm, "James Kovacs" <jkov...@post.harvard.edu> wrote:
> I'm with Fabio and Oren on this one. Session-per-request is much easier to
> implement and scale. That should be your default for a web-based
> application. That said, developers should know that session-per-conversation
> exists in case they need it.
>
> James
> --
> James Kovacs, B.Sc., M.Sc., MCSD, MCT
> Microsoft MVP - C# Architecturehttp://www.jameskovacs.com
> jkov...@post.harvard.edu
> 403-397-3177 (mobile)
>
> On Fri, Jun 20, 2008 at 7:51 AM, Fabio Maulo <fabioma...@gmail.com> wrote:
> > Tobes!!! at the end we can know you ;)
> > I know about your work in NHiA... I'm waiting it since long time ;).
>
> > Well...
> > Like you said session-per-conversation is not easy to implement and
> > sometimes is expensive from the point of view of an httpSession.
> > BTW there are some webApp that need it, or better, in some app
> > session-per-conversation is the only one solution.
> > I know one app, for an intranet, where the amount of complex-UseCase and
> > complex-business-transactions are much more than simple; there, reload data
> > on each request from tempTables was not the option so... no option than
> > session-per-conversation.
>
> > "The home" offert a green solution (green mean NOT mature). The main target
> > of NHibernate.Burrow (core) project is the management of
> > session-per-conversation in complex webApp environment. We would like to
> > have a shared solution for WinForm too (in NHibernate.Contrib project there
> > are some good soul working on it).
> >http://sourceforge.net/projects/nhcontrib
>
> > There are some others good implementations available in Castle and Spring.
>
> >http://www.castleproject.org/container/facilities/v1rc3/nhibernate/in...

James Kovacs

unread,
Jun 20, 2008, 4:55:09 PM6/20/08
to nhu...@googlegroups.com
@Tobin - I'm always amazed at the people who read my little piece of the web. Glad you've been enjoying my blog.

A question for you and Pierre Henri... Given the imminent release of NH2, will NH in Action still be NH 1.2. (I've read the MEAP edition and it is NH 1.2.) Or will the book be updated to NH2? Since you're still obviously editing and given the time-to-press, I'm guessing that the book will hit bookstores at about the same time as the final release of NH2.


James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP - C# Architecture
http://www.jameskovacs.com
jko...@post.harvard.edu
403-397-3177 (mobile)

Tobes

unread,
Jun 23, 2008, 3:42:40 PM6/23/08
to nhusers
@James

That is a good question. Pierre Henri and Manning gave this a lot of
consideration. However, because NH2 is alpha and the book was already
running late, attempting to cover the new NH2 capabilities would have
caused too many delays (demand for the book is already high, I hear!).
Not covering NH2 is a shame I think, but I can totally see why that
decision was made, and the book will deliver enormous value as it is I
hope.

T

On Jun 20, 9:55 pm, "James Kovacs" <jkov...@post.harvard.edu> wrote:
> @Tobin - I'm always amazed at the people who read my little piece of the
> web. Glad you've been enjoying my blog.
>
> A question for you and Pierre Henri... Given the imminent release of NH2,
> will NH in Action still be NH 1.2. (I've read the MEAP edition and it is NH
> 1.2.) Or will the book be updated to NH2? Since you're still obviously
> editing and given the time-to-press, I'm guessing that the book will hit
> bookstores at about the same time as the final release of NH2.
>
> James
> --
> James Kovacs, B.Sc., M.Sc., MCSD, MCT
> Microsoft MVP - C# Architecturehttp://www.jameskovacs.com
> jkov...@post.harvard.edu
> 403-397-3177 (mobile)
>
> On Fri, Jun 20, 2008 at 9:34 AM, Tobes <tobinharris...@googlemail.com>

James Kovacs

unread,
Jun 23, 2008, 3:50:40 PM6/23/08
to nhu...@googlegroups.com
My bigger concern is the breaking changes present in NH2. I would think that at least an appendix on v1.2 vs. v2 differences would be useful. From the clients with whom I talk, they are planning to upgrade rapidly to NH2 or have been running on the trunk due to the wealth of new features. Besides many of the libraries that build on top of NHibernate are moving moving or have already moved to NH2 alpha2 - for example Castle ActiveRecord and RhinoTools.

Just my 2 cents...

James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP - C# Architecture
http://www.jameskovacs.com
jko...@post.harvard.edu
403-397-3177 (mobile)

Fabio Maulo

unread,
Jun 23, 2008, 8:06:44 PM6/23/08
to nhu...@googlegroups.com
Perhaps more than an appendix (that can delay the release of the book) would be useful a link where download the appendix after NH2.0.0 will be released.
Manning can allow it without charge.. only a courtesy to who wait long time to have the book and Tobe have the necessary time to write a good appendix on how pass from NH1.2.1 to NH2.0.0.

My cent too ;)

Fabio Maulo.

P.S. Tobes if you need an hand let me know.

2008/6/23 James Kovacs <jko...@post.harvard.edu>:



--
Fabio Maulo

Ayende Rahien

unread,
Jun 23, 2008, 8:18:11 PM6/23/08
to nhu...@googlegroups.com
And an errata for 2.0, maybe?

James Kovacs

unread,
Jun 23, 2008, 9:46:41 PM6/23/08
to nhu...@googlegroups.com
The reality is that NH2 and NHiA are going to release about the same time. So people are going to buy the book, find out it is applicable to v1.2.1, and then go to download at the website where the recommended version is v2. Or they'll go to the website, download latest production version, want to know more about NHibernate, buy the book, and realize that it was written for v1.2.1. Either way, you've got the problem that the book is going to appear outdated as soon as it is released. The reality is that although there are some breaking changes, the vast majority of information in NHiA (yes, I've read the MEAP) is still applicable to v2.


James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP - C# Architecture
http://www.jameskovacs.com
jko...@post.harvard.edu
403-397-3177 (mobile)

Reply all
Reply to author
Forward
0 new messages