title: Truncate/Delete From on Hibernate
body: <p>Im having a problem when using <code>DELETE FROM myEntity</code>  </p>
  
  <p>I saw on my database that all the entry are gone, but when i tried to insert a previous existed entry, its still have the record from before i delete it.</p>
  
  <p>Here's the code :  </p>
  
  <pre><code>static SessionFactory session = NewHibernateUtil.getSessionFactory();
  
  public Session membukaSession(){
    return session.openSession();
  }
  
  public void clearRencanaPesan(){
      Session sess = this.membukaSession();
      Query query = sess.createQuery("delete from Rencanapesan");
      query.executeUpdate();
  }
  </code></pre>
  
  <p>So i tried using Truncate</p>
  
  <p>And this is the code :  </p>
  
  <pre><code>public void clearRencanaPesan(){
      Session sess = this.membukaSession();
      Query query = sess.createQuery("TRUNCATE Table Rencanapesan");
      query.executeUpdate();
  }
  </code></pre>
  
  <p>This one isn't working at all @@, the entry isnt deleted.</p>
  
  <p>this is the error</p>
  
  <p><code>Jun 18, 2012 11:01:54 PM org.hibernate.hql.ast.ErrorCounter reportError
  SEVERE: line 1:1: unexpected token: TRUNCATE
  Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: node to traverse cannot be null!</code></p>
  
  <p>Please help me, how can i truncate or delete all entry.<br>
  Thank you so much.  </p>