title: Spring @Transactional read-only propagation
body: <p>I'm experimenting with using the command pattern to allow my web layer to work with Hibernate entities within the context of a single transaction (thus avoiding lazy loading exceptions). I am, however, confused now with how I should deal with transactions.</p>
  <p>My commands call service layer methods that are annotated with <code>@Transactional</code> annotations. Some of these service layer methods are read-only - e.g. <code>@Transactional(readOnly = true)</code> - and some are read/write.</p>
  <p>My service layer exposes a command handler that executes commands passed to it on behalf of the web layer.</p>
  <pre><code>@Transactional
  public Command handle(Command cmd) throws CommandException
  </code></pre>
  <p>I assume I am right in making the command handler's <code>handle</code> method transactional. This is where the confusion comes in. If the implementation of a command makes calls to multiple service layer methods, there is no way for the command handler to know whether operations called within the command will be read-only, read/write or a combination of the two.</p>
  <p>I don't understand how propagation works in this example. If I were to make the <code>handle()</code> method <code>readOnly = true</code>, then what happens if the command then calls a service layer method that is annotated with <code>@Transactional(realOnly = false)</code>?</p>