public SqlMapRepositoryFactory(SqlMapClient sqlMapClient) {
    Assert.notNull(sqlMapClient, "SqlMapClient must not be null!");

    this.sqlMapClient = (SqlMapClientImpl) sqlMapClient;
    this.sqlMapClientTemplate = new SqlMapClientTemplate(sqlMapClient);

    if (ExtendedSqlMapClient.class.isAssignableFrom(sqlMapClient.getClass())) {
      this.sqlMapExecutorDelegate = ((ExtendedSqlMapClient) sqlMapClient).getDelegate();
    } else if (hasSqlMapExecutorDelegate(sqlMapClient)) {
      Field field = findSqlMapExecutorDelegate(sqlMapClient);
      field.setAccessible(true);

      this.sqlMapExecutorDelegate =
          (SqlMapExecutorDelegate) ReflectionUtils.getField(field, sqlMapClient);
    } else {
      throw new IllegalArgumentException("not found SqlMapExecutorDelegate in SqlMapClient.");
    }
  }