title: JPA 2.0, How can I fix the following 2 errors
body: <p>I'm actually learning JPA2.0 and I'm stuck with the following errors, consider than I'm using eclipse as IDE.</p>
  
  <pre><code>Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
      at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1215)
      at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1148)
      at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:307)
      at com.banking.core.persistence.utils.EntityManagerTest.main(EntityManagerTest.java:38)
  Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.loader.Loader.doList(Loader.java:2536)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
      at org.hibernate.loader.Loader.list(Loader.java:2271)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
      at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
      at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
      at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
      at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:274)
      ... 1 more
  Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'loanaccoun0_.id' in 'field list'
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
      at com.mysql.jdbc.Util.getInstance(Util.java:386)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
      at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2281)
      at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
      at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
      at org.hibernate.loader.Loader.doQuery(Loader.java:802)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
      at org.hibernate.loader.Loader.doList(Loader.java:2533)
      ... 9 more
  </code></pre>
  
  <p>this the query that I'm using right now...</p>
  
  <p><strong>LoanAccount.class</strong></p>
  
  <pre><code>@Entity
  @Table(schema="BANKING_CORE", name="NUMBER_OF_PAYMENTS")
  @DiscriminatorValue("LA")
  @NamedQuery(name = "LoanAccount.findByNumberofPayments", query = "SELECT lc from LoanAccount lc WHERE lc.numberOfPayments = :number_of_payments")
  </code></pre>
  
  <p>and this is the query itself</p>
  
  <p><strong>entitymanger.class</strong></p>
  
  <pre><code>LoanAccount lc = (LoanAccount)  em.createNamedQuery("LoanAccount.findByNumberofPayments").setParameter("number_of_payments", 25).getSingleResult();
  System.out.println(lc.getNumberOfPayments()+" "+lc.getCutOffDate());
  </code></pre>