Let me preface by saying that I'm relatively new to Grails and, as such, may be speaking out of ignorance here. If so, I apologize.
When I run a simple test with logical-delete, it doesn't work as expected. For example, TestEntity is annotated with @LogicalDelete
TestEntity te = new TestEntity(....)
te.save(flush:true)
def recordId = te.id
te.delete(flush:true)
println TestEntity.findById(recordId) //we'd expect null
println TestEntity.get(recordId) //we'd expect the entity
Both calls retrieve the entity even after the call to delete. By logging SQL, I can verify that both filter and delete "hijack" are working. But, the flush:true has no effect when passed to delete,
I can obtain the desired behavior by altering LogicalDeleteClassEnhancer#changeDeleteMethod and LogicalDeleteClassEnhancer#deleteAction such that we're always invoking save w/ arguments, but not sure that's the best way through...
Let me preface by saying that I'm relatively new to Grails and, as such, may be speaking out of ignorance here. If so, I apologize.
When I run a simple test with logical-delete, it doesn't work as expected. For example,
TestEntity
is annotated with@LogicalDelete
Both calls retrieve the entity even after the call to delete. By logging SQL, I can verify that both filter and delete "hijack" are working. But, the
flush:true
has no effect when passed todelete
,I can obtain the desired behavior by altering
LogicalDeleteClassEnhancer#changeDeleteMethod
andLogicalDeleteClassEnhancer#deleteAction
such that we're always invoking save w/ arguments, but not sure that's the best way through...