title: No identifier/primary key specified for Entity in doctrine 2
body: <p>I am using Zend 2 Framework and I am trying to get data using Doctrine 2.</p>
  <p>However the following error is coming in the Entity file.</p>
  <p><strong>Doctrine\ORM\Mapping\MappingException</strong></p>
  <p><strong>No identifier/primary key specified for Entity &quot;Acl\Entity\Permission&quot;. Every Entity must have an identifier/primary key.</strong></p>
  <p>How can I specify the primary key?</p>
  <p>I am using the following code.</p>
  <pre class="lang-php prettyprint-override"><code>/**
   * User Permissions
   *
   * @ORM\Entity
   * @ORM\Table(name=&quot;acl_permissions&quot;)
   * @property int $id
   * @property int $role_id
   * @property int $resource_id
   * @property string $action
   */
  class Permission
  {
      /**
       * @ORM\Column(type=&quot;integer&quot;)
       */
      public $id;
  
      /**
       * @ORM\Column(type=&quot;integer&quot;)
       * @ORM\OneToOne(targetEntity=&quot;Role&quot;)
       * @ORM\JoinColumn(name=&quot;role_id&quot;, referencedColumnName=&quot;id&quot;)
       */
      public $role;
  
      /**
       * @ORM\Column(type=&quot;integer&quot;)
       * @ORM\OneToOne(targetEntity=&quot;Resource&quot;)
       * @ORM\JoinColumn(name=&quot;resource_id&quot;, referencedColumnName=&quot;id&quot;)
       */
      public $resource;
  
      /**
       * @ORM\Column(type=&quot;string&quot;)
       */
      public $action;
  
      public function getRole()
      {
      return $this-&gt;role;
      }
  
      public function getResource()
      {
      return $this-&gt;resource;
      }
  }
  </code></pre>