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: Error performing batch delete in sybase
PostPosted: Fri Oct 13, 2006 12:39 pm 

Joined: Fri Oct 13, 2006 12:01 pm
Posts: 1
I have a class and subclass mapped in hibernate as a a joined sub-class. I perform a batch delete to remove all the instances of the subclass eg "Delete from SpecialProduct".

The way this seems to work is it creates a temporay table and uses that to delete from each table.

This works fine on HSQL but when i run the exact same on sybase (ASE 12.5) it fails, from what i can see it is trying to insert into the temporary table (in this case #SpecialProduct) before it is created. It either should create the temp table first or use syntax such (select x,y into #TempTable from A) and cerate the temp table in line. Any advice of if this is a bug and where I might start looking in the code to help resolve.


Hibernate version: 3.1.3

Mapping documents:

<class name="Product" table="Products">

        <id name="letProductId" column="ProductId">
            <generator class="assigned"/>

        <many-to-one name="soemthing" column="soemthing" not-null="true" class="AnotherClass"/>

        <joined-subclass name="SpecialProduct" table="SpecialProducts">
            <key column="ProductId"/>
            <property name="productId"      column="ProductId" not-null="true"/>


Code between sessionFactory.openSession() and session.close():
getHibernateTemplate().bulkUpdate("delete SpecialProduct");

Full stack trace of any exception that occurs:
2006-10-13 17:24:46,563 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 208, SQLState: 42000
2006-10-13 17:24:46,563 ERROR [org.hibernate.util.JDBCExceptionReporter] #SpeicalProducts not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).

2006-10-13 17:24:46,594 WARN [org.hibernate.hql.ast.exec.MultiTableDeleteExecutor] unable to drop temporary id table after use
com.sybase.jdbc3.jdbc.SybSQLException: Cannot drop the table '#SpecialProducts', because it doesn't exist in the system catalogs.

at com.sybase.jdbc3.tds.Tds.processEed(Tds.java:3069)

Name and version of the database you are using:
Sybase ASE 12.5
The generated SQL (show_sql=true):

insert into #SpecialProducts select speicalproduc0_.ProductId as LetProductId from SpeicalProducts Speicalproduc0_ inner join Products Speicalproduc0_1_ on Speicalproduc0_.ProductId=speicalproduc0_1_.ProductId

Debug level Hibernate log excerpt:

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.