diff --git a/doc/reference/src/orm.xml b/doc/reference/src/orm.xml index d7e2240d..3c82044f 100644 --- a/doc/reference/src/orm.xml +++ b/doc/reference/src/orm.xml @@ -221,7 +221,7 @@ XML fragment showing the declaration of HibernateTransactionManager is shown below. - <object id="HibernateTransactionManager" + <object id="transactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate"> <property name="DbProvider" ref="DbProvider"/> @@ -736,7 +736,7 @@ public class HibernateCustomerDao : ICustomerDao { <objects> - <object id="HibernateTransactionManager" + <object id="TransactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate"> <property name="DbProvider" ref="DbProvider"/> @@ -750,7 +750,7 @@ public class HibernateCustomerDao : ICustomerDao { <property name="CustomerDao" ref="CustomerDao"/> <property name="OrderDao" ref="OrderDao"/> <property name="ShippingService" ref="ShippingService"/> - <property name="TransactionManager" ref="HibernateTransactionManager"/> + <property name="TransactionManager" ref="TransactionManager"/> </object> @@ -817,7 +817,7 @@ public class HibernateCustomerDao : ICustomerDao { <objects> - <object id="HibernateTransactionManager" + <object id="TransactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate"> <property name="DbProvider" ref="DbProvider"/> @@ -845,13 +845,10 @@ public class HibernateCustomerDao : ICustomerDao { DeclarativeServicesAttributeDriven.xml. <objects xmlns="http://www.springframework.net" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:tx="http://www.springframework.net/schema/tx" - xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/schema/objects/spring-objects.xsd - http://www.springframework.net/schema/tx http://www.springframework.net/schema/tx/spring-tx-1.1.xsd"> + xmlns:tx="http://www.springframework.net/schema/tx"> - <object id="HibernateTransactionManager" + <object id="transactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate"> <property name="DbProvider" ref="DbProvider"/> @@ -1026,7 +1023,7 @@ public class HibernateCustomerDao : ICustomerDao { -
+
Session Scope The class Spring.Data.NHibernate.Support.SessionScope allows for @@ -1044,5 +1041,36 @@ public class HibernateCustomerDao : ICustomerDao { NHibernate 1.2's ICurrentSessionContext interface. See other sections in this chapter for further information on those usage scenarios.
+ +
+ Integration Testing + + When using Spring's Integration Testing + support, you should make sure that the hibernate session is + flushed so that the database is updated, as compared to just updating + the hibernate session cache. You can implement a base class as shown + below to help with the integration testing + + public abstract class NHibernateIntegrationTests : AbstractTransactionalSpringContextTests +{ + private SessionFactory sessionFactory; + + public ISessionFactory SessionFactory + { + get { return sessionFactory; } + set { sessionFactory = value; } + } + + protected override void OnSetUpInTransaction() + { + base.OnSetUpInTransaction(); + Assert.IsNotNull(SessionFactory); + SessionFactory.GetCurrentSession().FlushMode = FlushMode.Always; + SessionFactory.GetCurrentSession().CacheMode = CacheMode.Ignore; + } +} + + +