Closed vaibhav081 closed 4 years ago
Hi Vlad, I tried to debug the issue which I mentioned here((latest comment)): https://vladmihalcea.com/the-best-way-to-soft-delete-with-hibernate/?unapproved=65350&moderation-hash=c47056bca5464c5f342535491608e6eb#comment-65350
what I found from the logs is hibernate is executing a delete query on post_tag table before soft deleting the post entity, here are the logs:
2020-01-01 18:10:08,134 DEBUG [Alice]: n.t.d.l.SLF4JQueryLoggingListener - Name:DATA_SOURCE_PROXY, Time:1, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["delete from post_tag where post_id=?"], Params:[(1)] 2020-01-01 18:10:08,136 DEBUG [Alice]: n.t.d.l.SLF4JQueryLoggingListener - Name:DATA_SOURCE_PROXY, Time:0, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["UPDATE post SET deleted = true WHERE id = ?"], Params:[(1)]
It's good that you replicated it. Now, you need to add a breakpoint in the SLF4JQueryLoggingListener when the DELETE statement is executed and see why Hibernate does generate that.
SLF4JQueryLoggingListener
Hi Vlad, I tried to debug the issue which I mentioned here((latest comment)): https://vladmihalcea.com/the-best-way-to-soft-delete-with-hibernate/?unapproved=65350&moderation-hash=c47056bca5464c5f342535491608e6eb#comment-65350
what I found from the logs is hibernate is executing a delete query on post_tag table before soft deleting the post entity, here are the logs:
2020-01-01 18:10:08,134 DEBUG [Alice]: n.t.d.l.SLF4JQueryLoggingListener - Name:DATA_SOURCE_PROXY, Time:1, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["delete from post_tag where post_id=?"], Params:[(1)] 2020-01-01 18:10:08,136 DEBUG [Alice]: n.t.d.l.SLF4JQueryLoggingListener - Name:DATA_SOURCE_PROXY, Time:0, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["UPDATE post SET deleted = true WHERE id = ?"], Params:[(1)]