title: @Transactional in @Entity doesn't work?
body: <p>Going further into Hibernate i've stumbled upon the following situation:
  I have an @Entity Person</p>
  
  <pre><code>@Entity
  @Table(name = "PERSON")
  @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  @DiscriminatorColumn(name="type",discriminatorType=DiscriminatorType.STRING)
  @DiscriminatorValue(value="person")
  public class Person implements PersonInterface{
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = "USER_ID")
      protected Integer id;
  
      @Column(name = "NAME")
      protected String name;
  
      @ElementCollection
      @Formula("(SELECT groupId FROM PERSON_GROUPS WHERE id = id")
      protected List&lt;Integer&gt; groups = new ArrayList&lt;&gt;();
  
      @Override
      public Integer getId() {
          return id;
      }
  
      @Override
      public Collection&lt;Integer&gt; getGroups(){
          return groups;
      }
  
      @Override
      public String getName() {
          return name;
      }
  }
  </code></pre>
  
  <p>Which is split in two parts, Immutable and Mutable:</p>
  
  <pre><code>@Entity
  @DiscriminatorValue("mutableperson")
  @Transactional
  public class MutablePerson extends Person implements MutablePersonInterface{
  
      @Override
      public void setName(String name) {
          this.name = name;
      }
  
      @Override
      public void setId(Integer id) {
          this.id = id;
      }
  
      @Override
      public void setGroups(List&lt;Integer&gt; groupIds) {
          this.groups = groupIds;
      }
  
      public void excludeFromGroup(Integer groupId){
          Hibernate.initialize(this.groups);
          this.groups.remove(groupId);
      }
  }
  </code></pre>
  
  <p>Now, when i try to call something like:</p>
  
  <pre><code>Session session = sessionFactory.openSession();
  MutablePerson personFromDb = (MutablePerson) personService.getMutablePersonById(0);
  personFromDb.excludeFromGroup(group1.getId());
  session.saveOrUpdate(personFromDb);
  </code></pre>
  
  <p>I get an exception:</p>
  
  <pre><code>Exception in thread "main" org.hibernate.HibernateException: collection is not associated with any session
  at org.hibernate.collection.internal.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:704)
  at org.hibernate.Hibernate.initialize(Hibernate.java:65)
  at com.studytrails.tutorials.springhibernatejpa.MutablePerson.excludeFromGroup(MutablePerson.java:57)
  at com.studytrails.tutorials.springhibernatejpa.TestSpringHibernateJpa.main(TestSpringHibernateJpa.java:48)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:497)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  </code></pre>
  
  <p>Which tells me, that @Transactional annotation for that <code>MutablePerson</code> class doesn't really work and Hibernate is not creating a transaction.</p>
  
  <p>Here's this bit of my spring configuration:</p>
  
  <pre><code>&lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="jpaDialect" ref="jpaDialect" /&gt;
  &lt;/bean&gt;
  
  &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
  </code></pre>
  
  <p>As far as i can tell from Hibernate docs and examples, this config is correct and it should work, but it doesn't. Am i missing yet another Hibernate nuance here?</p>
  
  <p>P.S. I know i could've done this in DAO or Service class, but unfortunately i'm bound to use existing API, which works with groups in the mutable half of the entity.</p>