title: Spring @Transactional not working with @NoRepository hierarchy
body: <p>I have a base interface to contract a query for custom update. This is a library used in other spring applications, and in some enviroments I have a secondary &quot;transactionManager&quot; and also a secondary &quot;entityManager&quot;. If this secondary transactionManager exists in spring context, my repository must to use it.</p>
  <p>So here is the code of this base repository interface:</p>
  <pre class="lang-java prettyprint-override"><code>@NoRepository
  interface MyEntityRepository extends JpaRepository&lt;MyEntity, Integer&gt; {
  
     @Query(&quot;update ....&quot;)
     @Modifying
     void updateSomething();
  
  }
  </code></pre>
  <p>I have then two other interfaces to be defined with conditionals:</p>
  <pre class="lang-java prettyprint-override"><code>@Repository(&quot;myEntityRepository&quot;)
  @Transactional(transactionManager = &quot;sharedTransactionManager&quot;)
  @ConditionalOnBean(name = &quot;sharedTransactionManager&quot;)
  interface SharedMyEntityRepository extends MyEntityRepository {
  }
  
  @Repository(&quot;myEntityRepository&quot;)
  @Transactional
  @ConditionalOnMissingBean(name = &quot;sharedTransactionManager&quot;)
  interface DefaultMyEntityRepository extends MyEntityRepository {
  }
  
  </code></pre>
  <p>But when I run the <code>MyEntityRepository.updateSomething</code> method, I'm getting this error:</p>
  <pre><code>org.springframework.dao.InvalidDataAccessApiUsageException: no transaction is in progress; nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress
  </code></pre>
  <p>How can I solve this? Why spring isn't applying the transaction based on the two @Repository (SharedMyEntityRepository or DefaultMyEntityRepository) ?</p>