public function validatePrimaryKey(EntityDefinition $entityMetadata)
    {
        // check if all tables have exactly one primary key
        $countPrimaryKeys = 0;

        foreach ($entityMetadata['table']['columns'] as $column) {
            if (! empty($column['primary'])) {
                $countPrimaryKeys++;
            }
        }

        if ($countPrimaryKeys == 0) {
            throw new DomainException('No primary key defined in class ' . $entityMetadata['class'] . '.');
        } elseif ($countPrimaryKeys > 1) {
            throw new DomainException('No composite primary keys allowed for class ' . $entityMetadata['class'] . '.');
        }
    }