From ce22e68a9d655a43911784d98781559249fdf7c1 Mon Sep 17 00:00:00 2001 From: sbohlen Date: Thu, 30 Sep 2010 18:03:29 +0000 Subject: [PATCH] Added comment to clarify the reasoning behind the call to Session.Lock(...) in the sample app to ensure that future misunderstandings as lead to this forum post don't reoccur: http://forum.springframework.net/showthread.php?t=7261 --- .../App_Code/NHibernateCustomerEditController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Code/NHibernateCustomerEditController.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Code/NHibernateCustomerEditController.cs index 3a21b65a..ea158d6b 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Code/NHibernateCustomerEditController.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Code/NHibernateCustomerEditController.cs @@ -35,8 +35,12 @@ public class NHibernateCustomerEditController : ICustomerEditController get { Customer customer = currentCustomer; + + //since the Customer entity may have been retrieved from a prior request, we need to reattach it to the current session + // in order to support lazy-loading, etc. on the Customer Session.Lock(customer, LockMode.None); - return customer; + + return customer; } } }