title: Hibernate @Transactional rollback in Tests
body: <p>I'm saving and loading a @ManyToMany relationship using Hibernate.  I have unit tests for these and they are working fine and I can see the records correctly in the database.</p>
  <p>I'm attempting to write a JUnit test for updating of these @ManyToMany items.</p>
  <p>When I remove @Transactional from the test I get:</p>
  <pre><code>org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.foo.bar.PrimaryObject.manyToManySet, could not initialize proxy - no Session
  </code></pre>
  <p>But when I add @Transactional to the test I get:</p>
  <pre><code>Rolled back transaction for test: [DefaultTestContext@8bb5c2a testClass = PrimaryObjectManagerTest, testInstance = com.foo.bar.dataaccess.PrimaryObjectManagerTest@4d4337f9, testMethod = updatePrimaryObject@PrimaryObjectManagerTest, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@a5df98c testClass = AnnouncementManagerTest, locations = '{}', classes = '{class com.foo.bar.DataAccessApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@156b88f5, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@71def8f8, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@1da2cb77, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@1e04fa0a, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@5a56cdac, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@36b4cef0], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -&gt; false]]
  </code></pre>
  <p>So I cannot verify if there are any real changes to the database!</p>
  <p>I've tried adding to the test class:</p>
  <pre><code>@RecordApplicationEvents
  </code></pre>
  <p>but that doesn't help.</p>
  <p>How can I test an update when I'm dammned if I do and damned if I don't?
  Thank you!</p>