How to get Hibernate to reuse or recreate temporary tables during bulk updates

Hibernate handles UPDATE and DELETE operations for tables that are joined by the JOINED inheritance strategy, automatically creating temporary tables to store identifiers for updated or deleted records (excellent blog entry here: http://in.relation.to/Bloggers/MultitableBulkOperations ).

In one transaction, Hibernate creates a temporary table (named HT_mytable), inserts the record identifiers, deletes the records from mytable with the stored identifiers, and clears the HT_mytable.

However, in my case, it tries to create a table with each update without first checking if it exists by doing:

Hibernate: create global temporary table HT_child (record_id number (10,0) not null) 
on commit delete rows

So, Oracle throws an exception:

ERROR spi.SqlExceptionHelper - ORA-00955: name is already used by an existing object

How do I tell Hibernate not to create a table if it already exists?

+4
source share
1 answer

As far as I know, you cannot. However, you can drop the table on your own as a workaround or create your own bulk update strategy that implements it the way you would like.

+1
source

Source: https://habr.com/ru/post/1543295/


All Articles