Skip to content

Conversation

@robwgreenjr
Copy link

Previously when soft delete was set on a collection below SQL would be generated:

[Hibernate] 
    delete 
    from
        employee_accolades to_delete_ 
    where
        to_delete_.employee_fk in (select
            e1_0.id 
        from
            employees e1_0 
        where
            e1_0.id=1 
            and e1_0.deleted_at is null)

[Hibernate] 
    update
        employees e1_0 
    set
        deleted_at=localtimestamp 
    where
        e1_0.id=1 
        and e1_0.deleted_at is null

these changes make sure we don't physically delete with the new SQL looking like:

Hibernate: 
    update
        employee_accolades to_delete_ 
    set
        deleted_on=localtimestamp 
    where
        to_delete_.employee_fk in (select
            e1_0.id from employees e1_0 
        where
            e1_0.id=1 
            and e1_0.deleted_at is null)
Hibernate: 
    update
        employees e1_0 
    set
        deleted_at=localtimestamp 
    where
        e1_0.id=1 
        and e1_0.deleted_at is null

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant