-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Unable to do bulk delete
PostPosted: Mon May 11, 2009 11:56 am 
Newbie

Joined: Mon May 11, 2009 11:16 am
Posts: 13
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-335
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1361
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657

My Enviroment
Hibernate 3.2.6
Glassfish V2 and/or WAS 6.1

Thanks for suggestions


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.