Note that there are some explanatory texts on larger screens.

plurals
  1. POunexpected end of subtree exception after Hibernate version update on delete query
    primarykey
    data
    text
    <p>I get a strange exception when I delete all data from a table. The exception occurs since I updated the Hibernate version from 3.x.x to 4.2.6.</p> <p>the Dao method that I call to delete the data from the table:</p> <pre><code> @Override public void deleteAll() { EntityManager em = getEntityManager(); em.createQuery( "DELETE Document" ).executeUpdate(); } </code></pre> <p>Stacktrace:</p> <pre><code>12:46:03,570 ERROR ErrorCounter:50 - &lt;AST&gt;:0:0: unexpected end of subtree &lt;AST&gt;:0:0: unexpected end of subtree at org.hibernate.hql.internal.antlr.SqlGeneratorBase.whereClauseExpr(SqlGeneratorBase.java:1378) at org.hibernate.hql.internal.antlr.SqlGeneratorBase.whereClause(SqlGeneratorBase.java:1272) at org.hibernate.hql.internal.ast.exec.DeleteExecutor.&lt;init&gt;(DeleteExecutor.java:72) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.buildAppropriateStatementExecutor(QueryTranslatorImpl.java:535) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:201) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:138) at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:105) at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:80) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:221) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:199) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1778) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:291) at sun.reflect.GeneratedMethodAccessor800.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) </code></pre> <p>Entity:</p> <pre><code>@Entity @Table( name = "document" ) public class Document implements Serializable { @Override @Id @GeneratedValue( strategy = GenerationType.IDENTITY ) @Column( name = "document_id" ) private int id; private String filename; @Temporal( TemporalType.TIMESTAMP ) @Column( name = "file_modified_time" ) private Date fileModifiedTime; @ManyToOne( fetch = FetchType.LAZY ) @JoinColumn( name = "attached_to_Task_fk" ) private Task attachedToTaskFk; //Getter/Setter } </code></pre> <p>When I add a where clause to the delete query, the exception doesn't occur.</p> <pre><code>em.createQuery( "DELETE Document d WHERE d.id &gt; 0" ).executeUpdate(); </code></pre> <p>But I don't think that Hibernate intended it this way.</p> <p>I already checked following topics:</p> <ul> <li><a href="https://stackoverflow.com/questions/2066361/hibernate-and-unexpected-end-of-subtree-exception">unexpected end of subtree</a></li> <li><a href="https://stackoverflow.com/questions/2066361/hibernate-and-unexpected-end-of-subtree-exception">Hibernate and Unexpected end of Subtree exception</a></li> </ul> <p>Has anyone any idea how to fix this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload