Hi
I've added FROM and the exception has been thrown:
Code:
Transaction tx = session.beginTransaction();
BusinessCase businessCase = (BusinessCase) session.get(BusinessCase.class, actionOnId);
session.delete(businessCase); // (*)
// this throws exception (if I omit FROM keyword, it won't)
session.createQuery("DELETE FROM Message WHERE MESSAGE_KEY_ID = :msgKey1 OR MESSAGE_KEY_ID = :msgKey2")
.setParameter("msgKey1", businessCase.getTitleMessageKey())
.setParameter("msgKey2", businessCase.getDescriptionMessageKey()).executeUpate();
tx.commit();
Code:
ERROR parser - *** ERROR: <AST>:0:0: unexpected end of subtree
ERROR parser - *** ERROR: <AST>:0:0: unexpected end of subtree
ERROR MethodBindingImpl - Exception while invoking expression #{businessCaseList.delete}
java.lang.NullPointerException
at org.hibernate.hql.antlr.HqlSqlBaseWalker.path(HqlSqlBaseWalker.java:2193)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2232)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:498)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.deleteStatement(HqlSqlBaseWalker.java:276)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:156)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:814)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:801)
at org.hibernate.impl.QueryImpl.executeUpate(QueryImpl.java:89)eryImpl.java:89)
... (my code)
bug?
And one more issue:
As you can see, this excpetion was thrown in the transaction. Previous command (*) was to delete persistent object. Although the transaction wasn't commited, the object was removed from the cache (why?!), but not from database (OK).
Using Hibernate 3.0,Tomcat 5.0, Java 1.4.1