使用Hibernate实现软删除的最佳方法是在类上使用@SQLDelete批注。
确保您的映射设置为级联删除
调用session.delete(yourClass)应该可以实现软删除
hibernate文档
//used to overide the normal delete behavior@SQLDelete(sql="UPDATE (table_name) SET deleted = '1' WHERe id = ?")//optional Use this to exclude deleted element from get @Where(clause="deleted <> '1'")//OR (Filter may also be used if you need to load deleted items occasionally)@FilterDef(name="ProductFilter",defaultCondition="deleted <> 1 ")



