Max Stewart
Max Stewart

Reputation: 3583

What are the benefits of session-per-conversation?

Currently I'm using a session-per-request approach to manage Hibernate sessions in a Java web application. I heard the term session-per-conversation thrown around and was wondering what situations it suits and what benefits it can bring over session-per-request?

Upvotes: 5

Views: 1786

Answers (1)

Simon Groenewolt
Simon Groenewolt

Reputation: 10665

One of the main benefits I've experienced is that you can implement behavior where not every change should directly be committed to the database -- Session per conversation will allow you to set up objects over multiple requests, and only commit to the db on the final 'yes I really want to do this' action. Typical scenarios for this are things like booking a hotel room using a wizard-like series of pages.

Upvotes: 2

Related Questions