/** {@inheritDoc} */
  @Override
  public TransactionContext start() throws Exception {
    TransactionContext txnContext = holder.get();
    if (txnContext != null) {
      throw new TransactionException("A transaction was found in the ThreadLocal.");
    }

    txnContext = new DefaultTransactionContext();
    holder.set(txnContext);

    // Check the thread locals for known resources
    Connection connection = ConnectionContext.get();
    if (connection != null) {
      txnContext.add(new JDBCTransactionalResource(connection));
    }

    EntityManager em = EntityManagerContext.get();
    if (em != null) {
      txnContext.add(new JPATransactionalResource(em));
    }

    return txnContext;
  }