[hibernate-dev] Multi-table Bulk id strategy using Common Table Expressions

Vlad Mihalcea mihalcea.vlad at gmail.com
Wed Mar 23 09:04:43 EDT 2016


Hi,

I found a very interesting solution for the Bulk id multi-table strategy
for those cases when the DB management policy forbids creating Temporary
Tables.
This situation is documented in this Forum post:

https://forum.hibernate.org/viewtopic.php?f=1&t=1043080&p=2489096#p2489096

After doing some investigation, I found this project on GitHub:

https://github.com/epiresdasilva/cte-multi-table-bulk-id-stategy

After migrating it for Hibernate 5.x, I tested it and it works very nice,
generating queries like this:

with HT_announecement ( id ) as (
values
    (?), (?) )
delete
    from
        announcement
    where
        (
            id
        ) IN (
            select
                id
            from
                HT_announecement
        )

I think we should take this idea and write and come up with a built-in
strategy using CTE.

What do you think?

Vlad


More information about the hibernate-dev mailing list