protected function _buildFields()
    {
        $db = CarteBlanche::getContainer()->get('entity_manager')
            ->getStorageEngine($this->getDatabaseName());
        foreach ($this->getStructureEntry('structure') as $_field=>$_data)  {
            $_f = null;
            if (preg_match('/^(.*)_id$/i', $_field, $matches)) {
                if (isset($matches[1]) && is_string($matches[1])) {
                    $related_object = $matches[1];
                    if ($related_object=='parent')
                        $related_object = $this->getTableName();
                    $table = AutoObjectMapper::getAutoObject($related_object, $this->getDatabaseName());
                    $_f = new Relation(
                        $_field, $_data, $db, $related_object, $table->getModel()
                    );
                }
            } else {
                $_f = new Field( $_field, $_data, $db );
            }

            if (!is_null($_f))
                $this->object_fields->setEntry( $_field, $_f );
        }
    }