title: Doctrine 2 ManyToOne mapping annotations
body: <p>TwitterTweets entity:</p>
  
  <pre><code>/**
   * MyBundle\CoreBundle\Entity\TwitterTweets
   *
   * @ORM\Table(name="twitter_tweets")
   * @ORM\Entity
   */
  class TwitterTweets
  {
      /**
       * @var TwitterUsers
       *
       * @ORM\ManyToOne(targetEntity="TwitterUsers", inversedBy="tweets")
       * @ORM\JoinTable(name="twitter_tweets",
       *   joinColumns={
       *     @ORM\JoinColumn(name="twitter_user_id", referencedColumnName="twitter_id")
       *   }
       * )
       */
      private $twitterUser;
  }
  </code></pre>
  
  <p>TwitterUsers entity:</p>
  
  <pre><code>/**
   * MyBundle\CoreBundle\Entity\TwitterUsers
   *
   * @ORM\Table(name="twitter_users")
   * @ORM\Entity
   */
  class TwitterUsers
  {
      /**
       * @var TwitterTweets
       *
       * @ORM\OneToMany(targetEntity="TwitterTweets", mappedBy="twitterUser")
       */
      private $tweets;
  }
  </code></pre>
  
  <p>twitter_tweets table:</p>
  
  <pre><code>CREATE TABLE `twitter_tweets` (
   `period` int(6) unsigned NOT NULL,
   `tweet_id` varchar(30) NOT NULL,
   `twitter_user_id` bigint(20) unsigned NOT NULL,
   `tweet` varchar(255) NOT NULL,
   `url` text NOT NULL,
   `retweet_count` varchar(10) NOT NULL DEFAULT '0',
   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
   PRIMARY KEY (`period`,`tweet_id`),
   KEY `period` (`period`),
   KEY `tweet_id` (`tweet_id`),
   KEY `twitter_user_id` (`twitter_user_id`),
   KEY `created_at` (`created_at`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>twitter_users table:</p>
  
  <pre><code>CREATE TABLE `twitter_users` (
   `twitter_id` bigint(20) unsigned NOT NULL,
   `user` varchar(255) NOT NULL,
   `username` varchar(255) NOT NULL,
   `profile_image_url` text NOT NULL,
   PRIMARY KEY (`twitter_id`),
   KEY `user` (`user`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>I get this error executing a simple SELECT:</p>
  
  <pre><code>$this-&gt;getDoctrine()-&gt;getRepository('MyBundleCoreBundle:TwitterTweets')-&gt;findOneBy(array( 'tweetId' =&gt; $data-&gt;tweet_id ))
  </code></pre>
  
  <p><strong>Column not found: 1054 Unknown column 't0.twitterUser_id' in 'field list'</strong></p>
  
  <pre><code>SELECT t0.period AS period1, t0.tweet_id AS tweet_id2, t0.tweet AS tweet3,
  t0.url AS url4, t0.retweet_count AS retweet_count5, t0.created_at AS created_at6,
  t0.twitterUser_id AS twitterUser_id7
  FROM twitter_tweets t0 WHERE t0.tweet_id = ?
  </code></pre>
  
  <p>How can i solve this issue?
  I tried to set only the @ORM\JoinColumn (without JoinTable annotation) but i get this error:</p>
  
  <p><strong>"message":"SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.twittertweets_twittertrends' doesn't exist"</strong></p>