title: Hibernate cannot find mappings for classes for tables it just created
body: <p>I have hibernate creating my database schema for me. It's able to create the tables just fine, but the named queries do not compile because it claims the objects aren't mapped.</p>
  
  <p>The entire application is annotation and config driven: there are no <code>.xml</code> files.</p>
  
  <p>Here is the relevant config portions:</p>
  
  <pre><code>properties = new Properties();
  properties.setProperty("hibernate.connection.driver_class", "org.postgresql.Driver");
  properties.setProperty("hibernate.connection.url", con);
  properties.setProperty("hibernate.connection.username", user);
  properties.setProperty("hibernate.connection.password", pass);
  properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
  properties.setProperty("hibernate.current_session_context_class","thread");
  properties.setProperty("hibernate.hbm2ddl.auto","create");
  
  Configuration config = new Configuration();
  config.setProperties(properties);
  config.addAnnotatedClass(Player.class);
  SessionFactory factory = config.buildSessionFactory();
  </code></pre>
  
  <p>My player class is pretty barebones right now - it has some parameters like name and id. It happily translates these into a proper table.</p>
  
  <pre><code>@Entity
  @NamedQueries({
      @NamedQuery(name="verifyPlayerByUuid", query="SELECT name FROM player WHERE uuid = :uuid"),
      @NamedQuery(name="verifyPlayerByName", query="SELECT name FROM player WHERE name = :name"),
      @NamedQuery(name="obtainPlayerByUuid", query="FROM player WHERE uuid = :uuid"),
  })
  public class Player {
      // impl here
  }
  </code></pre>
  
  <p>When I run it, I get this. Note that I trimmed out the boilerplate timestamp and hibernate package names to make more room for the relevant messages. I also took liberties in formatting the message to better organize the data - this involved only the addition of whitespace.</p>
  
  <pre><code>[timestamp] [hib].hbm2ddl.SchemaExport   - HHH000227: Running hbm2ddl schema export
  [timestamp] [hib].hbm2ddl.SchemaExport   - HHH000230: Schema export complete
  
  [timestamp] [hib].SessionFactoryImpl     - HHH000177: Error in named query: verifyPlayerByUuid
  org.hibernate.hql.internal.ast.QuerySyntaxException: 
      player is not mapped [SELECT name FROM player WHERE uuid = :uuid]
  
  [timestamp] [hib].SessionFactoryImpl     - HHH000177: Error in named query: obtainPlayerByUuid
  org.hibernate.hql.internal.ast.QuerySyntaxException: 
      player is not mapped [FROM player WHERE uuid = :uuid]
  
  [timestamp] [hib].SessionFactoryImpl     - HHH000177: Error in named query: verifyPlayerByName
  org.hibernate.hql.internal.ast.QuerySyntaxException: 
      player is not mapped [SELECT name FROM player WHERE name = :name]
  </code></pre>