code: public <T> T getSingleResult(Class<T> clazz, String sql, Object[] params) {
          PreparedStatement stmt = null;
          ResultSet rs = null;
          try {
              stmt = connectionProvider.getConnection().prepareStatement(sql);
              setParameters(stmt, params);
  
              if (logger.isDebugEnabled()) {
                  printSql(sql);
                  printParameters(params);
              }
  
              rs = stmt.executeQuery();
              ResultSetMetaData meta = rs.getMetaData();
              int columnCount = meta.getColumnCount();
  
              BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz);
  
              if(rs.next()){
                  T entity = entityOperator.createEntity(clazz, rs, meta, columnCount, beanDesc,
                          dialect, valueTypes, nameConverter);
                  return entity;
              }
  
              return null;
  
          } catch (SQLException ex) {
              throw new SQLRuntimeException(ex);
  
          } finally {
              JdbcUtil.close(rs);
              JdbcUtil.close(stmt);
          }
      }
docs: Returns a single entity from the first row of an SQL.
  
  @param <T> the entity type
  @param clazz the class of the entity
  @param sql the SQL to execute
  @param params the parameters to execute the SQL
  @return the entity from the result set.
  
  @throws SQLRuntimeException if a database access error occurs