public function selectAsEntity($joinSingleRelatives = false, $class = null)
    {
        $this->init();
        $eol = PHP_EOL;

        if ($class) {
            $this->selectClause = 'SELECT resource'.PHP_EOL;
            $this->fromClause = "FROM {$class} resource{$eol} JOIN resource.resourceNode node{$eol}";
        } else {
            $this->selectClause = 'SELECT node'.PHP_EOL;
        }

        $this->joinSingleRelatives = $joinSingleRelatives;

        return $this;
    }