title: Hibernate : MySQLSyntaxErrorException: Unknown column ' ____ ' in 'field list'
body: <p>I am new to Hibernate. </p>
  
  <p>I want to fetch all records from Transaction table,</p>
  
  <p>I got following error</p>
  
  <pre><code> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column transactio2_.deleted' in 'field list'
  </code></pre>
  
  <p>Though <code>deleted</code> column in present in Table</p>
  
  <p><strong>Entity Class :</strong></p>
  
  <pre><code>@Entity
  @Table(name = "transaction")
  public class Transaction implements Comparable&lt;Transaction&gt;
  {
  @Id
  @GeneratedValue
  @Column(name = "transactionId")
  private int transactionId;
  
  @Column(name = "date")
  private Date date;
  
  @Column(name = "amount")
  private BigDecimal amount;
  
  @ManyToOne
  @JoinColumn(name = "transactionTypeId")
  private TransactionType transactionType;
  
  @ManyToOne
  @JoinColumn(name = "userId")
  private User user;
  
  @Column(name = "operation")
  private String operation;
  
  @Column(name = "lastUpdate")
  private Date lastUpdate;
  
  @Column(name = "deleted")
  private int deleted;
  
  @Column(name = "remark")
  private String remark;
  
  public Transaction()
  {
      super();
  }
  
  @Override
  public int compareTo(Transaction c)
  {
      if (getTransactionId() &lt; c.getTransactionId())
      {
          return -1;
      }
      if (getTransactionId() &gt; c.getTransactionId())
      {
          return 1;
      }
      return 0;
  }
  
  public Date getLastUpdate()
  {
      return lastUpdate;
  }
  
  public void setLastUpdate(Date lastUpdate)
  {
      this.lastUpdate = lastUpdate;
  }
  
  public User getUser()
  {
      return user;
  }
  
  public void setUser(User user)
  {
      this.user = user;
  }
  
  public int getDeleted()
  {
      return deleted;
  }
  
  public void setDeleted(int deleted)
  {
      this.deleted = deleted;
  }
  
  public int getTransactionId()
  {
      return transactionId;
  }
  
  public void setTransactionId(int transactionId)
  {
      this.transactionId = transactionId;
  }
  
  public Date getDate()
  {
      return date;
  }
  
  public void setDate(Date date)
  {
      this.date = date;
  }
  
  public BigDecimal getAmount()
  {
      return amount;
  }
  
  public void setAmount(BigDecimal amount)
  {
      this.amount = amount;
  }
  
  public TransactionType getTransactionType()
  {
      return transactionType;
  }
  
  public void setTransactionType(TransactionType transactionType)
  {
      this.transactionType = transactionType;
  }
  
  public String getOperation()
  {
      return operation;
  }
  
  public String getRemark()
  {
      return remark;
  }
  
  public void setRemark(String remark)
  {
      this.remark = remark;
  }
  
  public void setOperation(String operation)
  {
      this.operation = operation;
  }
   }
  </code></pre>
  
  <p><strong>Hibernate transactionBean :</strong></p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  public class TransactionBean implements Serializable
  {
  
      ArrayList&lt;Transaction&gt; transactionList = new ArrayList&lt;&gt;();
  
      /**
     * Public Constructor
      */
  public TransactionBean()
  {
       Session session = HibernateUtil.getSessionFactory().openSession();
      @SuppressWarnings("unchecked")
      transactionList = (ArrayList&lt;Transaction&gt;) session.createCriteria(Transaction.class).list();     
  }
  </code></pre>
  
  <p>What goes wrong in my code ?</p>
  
  <p><strong>Edit : Here is create statement of DB Table</strong> </p>
  
  <pre><code> delimiter $$
  
     CREATE TABLE `transaction` (
        `transactionId` int(11) NOT NULL AUTO_INCREMENT,
        `date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
        `amount` decimal(10,2) DEFAULT NULL,
        `transactionTypeId` int(11) NOT NULL,
        `operation` varchar(45) DEFAULT NULL,
        `lastUpdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
        `userId` int(11) NOT NULL,
        `deleted` tinyint(4) NOT NULL DEFAULT '0',
        `remark` varchar(450) DEFAULT NULL,
          PRIMARY KEY (`transactionId`),
          KEY `fk_transaction_1` (`userId`),
          KEY `fk_transaction_2` (`transactionTypeId`),
          CONSTRAINT `fk_transaction_1` FOREIGN KEY (`userId`) REFERENCES `user` (`userId`) ON     DELETE NO ACTION ON UPDATE NO ACTION,
         CONSTRAINT `fk_transaction_2` FOREIGN KEY (`transactionTypeId`) REFERENCES   `transaction_type` (`transactionTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION
  ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1$$
  </code></pre>