Deletion without deleting the database object

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Deletion without deleting the database object

Andréas Kühne
Hi,

I'm looking for a plugin or someone who can point me in the right direction for solving a small problem I am having. On some of my domain classes I would like to keep them instead of deleting them when calling the delete() method. Instead I would like to set a deletedDate property and remove the items with a deleted date set from searches and gets.

Has anyone done this before? Is it possible?

Is there any other way to accomplish what I want? I would like to be able to recover the database more or less in real-time, in case a client deletes some objects that they shouldn't.

Regards,

Andréas
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Deletion without deleting the database object

bkane
We had this requirement for some of our classes to enable an "undo" operation, or to keep the full details for auditing purposes.  

Admittedly I didn't look very hard, but didn't find anything out there to do it for us.  We just set a deleted flag on the object, and always query where deleted = false.  Instead of get(id) you have something like findByDeletedAndId(false,id)  We use the audit-trail and audit-logging plugins to track who made the change and when.  Not sure if this is the best solution, but it is working for us in the few cases where we need soft deletes.

Brandon


On Mon, Mar 14, 2011 at 5:45 PM, Andréas Kühne <[hidden email]> wrote:
Hi,

I'm looking for a plugin or someone who can point me in the right direction for solving a small problem I am having. On some of my domain classes I would like to keep them instead of deleting them when calling the delete() method. Instead I would like to set a deletedDate property and remove the items with a deleted date set from searches and gets.

Has anyone done this before? Is it possible?

Is there any other way to accomplish what I want? I would like to be able to recover the database more or less in real-time, in case a client deletes some objects that they shouldn't.

Regards,

Andréas
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Deletion without deleting the database object

scryan
You can use the hibernate filter plugin and use stop dates. Then all your queries will be protected

Scott ryan

Sent from my iPhone

On Mar 14, 2011, at 7:30 PM, Brandon Kane <[hidden email]> wrote:

We had this requirement for some of our classes to enable an "undo" operation, or to keep the full details for auditing purposes.  

Admittedly I didn't look very hard, but didn't find anything out there to do it for us.  We just set a deleted flag on the object, and always query where deleted = false.  Instead of get(id) you have something like findByDeletedAndId(false,id)  We use the audit-trail and audit-logging plugins to track who made the change and when.  Not sure if this is the best solution, but it is working for us in the few cases where we need soft deletes.

Brandon


On Mon, Mar 14, 2011 at 5:45 PM, Andréas Kühne <[hidden email]> wrote:
Hi,

I'm looking for a plugin or someone who can point me in the right direction for solving a small problem I am having. On some of my domain classes I would like to keep them instead of deleting them when calling the delete() method. Instead I would like to set a deletedDate property and remove the items with a deleted date set from searches and gets.

Has anyone done this before? Is it possible?

Is there any other way to accomplish what I want? I would like to be able to recover the database more or less in real-time, in case a client deletes some objects that they shouldn't.

Regards,

Andréas
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Deletion without deleting the database object

Uday Pratap Singh
In reply to this post by bkane
In one of my project we also had the requirement of soft deletion on existing code base and we don't want to change the existing code. But thankfully we found hibernate filter plugin . You can take a look at it, it might fit into your context as well.

On Tue, Mar 15, 2011 at 7:00 AM, Brandon Kane <[hidden email]> wrote:
We had this requirement for some of our classes to enable an "undo" operation, or to keep the full details for auditing purposes.  

Admittedly I didn't look very hard, but didn't find anything out there to do it for us.  We just set a deleted flag on the object, and always query where deleted = false.  Instead of get(id) you have something like findByDeletedAndId(false,id)  We use the audit-trail and audit-logging plugins to track who made the change and when.  Not sure if this is the best solution, but it is working for us in the few cases where we need soft deletes.

Brandon


On Mon, Mar 14, 2011 at 5:45 PM, Andréas Kühne <[hidden email]> wrote:
Hi,

I'm looking for a plugin or someone who can point me in the right direction for solving a small problem I am having. On some of my domain classes I would like to keep them instead of deleting them when calling the delete() method. Instead I would like to set a deletedDate property and remove the items with a deleted date set from searches and gets.

Has anyone done this before? Is it possible?

Is there any other way to accomplish what I want? I would like to be able to recover the database more or less in real-time, in case a client deletes some objects that they shouldn't.

Regards,

Andréas
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email






--
Regards
##Uday Pratap Singh##
Intelligrape software (P)Ltd.
Reply | Threaded
Open this post in threaded view
|

Re: Deletion without deleting the database object

Andréas Kühne
Thanks for the pointers in the right direction. I think that the hibernate-filter plugin is the way to go. However I have run into an issue. It does work on queries, but doesn't seem to work on a standard get, I would like that to work also. Has anyone any experience of this?

// Andréas

15 mar 2011 kl. 05.40 skrev Uday Pratap Singh:

In one of my project we also had the requirement of soft deletion on existing code base and we don't want to change the existing code. But thankfully we found hibernate filter plugin . You can take a look at it, it might fit into your context as well.

On Tue, Mar 15, 2011 at 7:00 AM, Brandon Kane <[hidden email]> wrote:
We had this requirement for some of our classes to enable an "undo" operation, or to keep the full details for auditing purposes.  

Admittedly I didn't look very hard, but didn't find anything out there to do it for us.  We just set a deleted flag on the object, and always query where deleted = false.  Instead of get(id) you have something like findByDeletedAndId(false,id)  We use the audit-trail and audit-logging plugins to track who made the change and when.  Not sure if this is the best solution, but it is working for us in the few cases where we need soft deletes.

Brandon


On Mon, Mar 14, 2011 at 5:45 PM, Andréas Kühne <[hidden email]> wrote:
Hi,

I'm looking for a plugin or someone who can point me in the right direction for solving a small problem I am having. On some of my domain classes I would like to keep them instead of deleting them when calling the delete() method. Instead I would like to set a deletedDate property and remove the items with a deleted date set from searches and gets.

Has anyone done this before? Is it possible?

Is there any other way to accomplish what I want? I would like to be able to recover the database more or less in real-time, in case a client deletes some objects that they shouldn't.

Regards,

Andréas
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email






--
Regards
##Uday Pratap Singh##
Intelligrape software (P)Ltd.