public function setID($id)
    {
        $dao = $this->getDAO();
        $pkey = $dao->getPrimaryKey();

        if (count($pkey) === 1 && is_scalar($id))
        {
            $pcol = reset($pkey);
            $this->setField($pcol->getName(), $id);
        }
        elseif (is_array($id) && array_keys($id) === array_keys($pkey))
        {
            foreach ($pkey as $name => $def)
            {
                $this->setField($name, $id[$name]);
            }
            $this->_id = $id;
        }
        else
        {
            throw new InvalidTypeException("Provided ID does not match primary key");
        }
        return $this;
    }