Dev - on delete/update cascade support?

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

Dev - on delete/update cascade support?

Leon Torres-2
Hi all,

I'm faced with a requirement to completely remove all data for a party. The
nautre of the party data is such that I can delete all records by hand for now.
However, keeping this up to date as the datamodel evolves is going to be hard.

This raises a question: Does OFBiz have the ability to support ON DELETE CASCADE
or ON UPDATE CASCADE? If not, how hard would it be to allow this?

Thanks,

- Leon
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - on delete/update cascade support?

David E. Jones

Leon,

With SQL the only way to do these sorts of cascades is to set them up as part of a foreign key definition. In other words for a given foreign key it will always happen for all covered operations and there is no way to do it per operation. For most operational data this isn't really a "safe" way to go: it's way too easy to mess up and you lose not only the protection of foreign keys, but it becomes even worse because now the foreign are destroying data that you may not expect to be affected by an operation.

For those that want to do it any such constraint can be changed directly in the database.

-David


Leon Torres wrote:

> Hi all,
>
> I'm faced with a requirement to completely remove all data for a party. The
> nautre of the party data is such that I can delete all records by hand for now.
> However, keeping this up to date as the datamodel evolves is going to be hard.
>
> This raises a question: Does OFBiz have the ability to support ON DELETE CASCADE
> or ON UPDATE CASCADE? If not, how hard would it be to allow this?
>
> Thanks,
>
> - Leon
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - on delete/update cascade support?

Hans Bakker
In reply to this post by Leon Torres-2
Hi Leon,
I had the same requirement for export and succeeded partly, you may have a
look at otsutils.java where i called the function explode....

regards,
Hans

On Wednesday 29 March 2006 05:43, Leon Torres wrote:

> Hi all,
>
> I'm faced with a requirement to completely remove all data for a party. The
> nautre of the party data is such that I can delete all records by hand for
> now. However, keeping this up to date as the datamodel evolves is going to
> be hard.
>
> This raises a question: Does OFBiz have the ability to support ON DELETE
> CASCADE or ON UPDATE CASCADE? If not, how hard would it be to allow this?
>
> Thanks,
>
> - Leon
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Dev - on delete/update cascade support?

Adam Heath-2
In reply to this post by David E. Jones
On Tue, 28 Mar 2006, David E. Jones wrote:

>
> Leon,
>
> With SQL the only way to do these sorts of cascades is to set them up as
> part of a foreign key definition. In other words for a given foreign key it
> will always happen for all covered operations and there is no way to do it
> per operation. For most operational data this isn't really a "safe" way to
> go: it's way too easy to mess up and you lose not only the protection of
> foreign keys, but it becomes even worse because now the foreign are
> destroying data that you may not expect to be affected by an operation.
>
> For those that want to do it any such constraint can be changed directly in
> the database.

Actually, that's not correct.  There is enough meta data known by the
entitymodel code to support this; it just requiring writing.

I'll add it to my list.
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev