Hello Forum,
I have a question regarding a bulk delete at Hibernate with JPA in Glassfish and/or WAS 6.1.
My problem has been reported before but the answers I found were not very helpful.
I always get this exception
Quote:
Caused by: org.hibernate.exception.SQLGrammarException: could not insert/select ids for bulk delete
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.exec.MultiTableDeleteExecutor.execute(MultiTableDeleteExecutor.java:102)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:396)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1141)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:49)
... 53 more
Caused by: java.sql.SQLException: ORA-00942: Tabelle oder View nicht vorhanden (Table or View not existing)
The query which produces this error is very simple and I quess uncritcally
Code:
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void aMethodName(){
//......
Query qAct = em.createQuery("DELETE from ASuperClass a where a.eventMessage.creationDate <= :offsetDate");
qAct.setParameter("offsetDate",archiveOffsetDate, TemporalType.TIMESTAMP);
int deletedActions = qAct.executeUpdate();
//...
}
You might have to know that this is an Entity which has some SubClasses , if that matters something.
Hibernate always creates some temporary tables with the prefix HT_
An insert into this temporary table looks like this
Quote:
insert into HT_A_SUPERCLASS select entityName0_.id as id from A_SUPERCLASS entityName0_ where CREATION_DATE<=?
and when trying to delete the table with this query
Quote:
delete from HT_A_SUPERCLASS
the above provided exception occurs, respectively I guess that because this is last output before the exception is thrown
When I do a unit test everything works fine, but the HT_ .... tables will not be deleted after test execution.
Now my questions.
Is it possible to switch of that automatic table creation and furthermore how can I solve that exception problem.
If found some postings in the issue tracking system of hibernate which are related to mine but as said before nothing pleased me well.
http://opensource.atlassian.com/projects/hibernate/browse/EJB-335http://opensource.atlassian.com/projects/hibernate/browse/HHH-1361http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657My Enviroment
Hibernate 3.2.6
Glassfish V2 and/or WAS 6.1
Thanks for suggestions