I got a 3 objects: CustomerCategory, Customer, Order
It shall behave like this: if i delete a category, all customers under the category shall be deleted, and all orders under each deleted customer shall be deleted also.
In xml mapping file, i aready set the autodelete to true.
now, back to my problem, i must populate the customercollection in customer category in order to delete customers away, and i must populate OrderCollection in each deleted customer before i can delete all orders! Another way is that to use DeleteCriteria. But, still, a lot of database queries must be done before i can remove all related data entries from database.
This shall not be the best way in handling with relational database, right?
Maybe there is another better way in the framework, please advise me ....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for the delay in responding - it's been busy :-)
You're right about the delete not being done the best way, however at the moment I haven't implemented a better solution.
If I get some time soon, I'll try an implement a better delete, but in the meantime could you create an entry in the Requests (RFE) section so that I have a reminder (and so you'll see when things get updated).
- Richard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got a 3 objects: CustomerCategory, Customer, Order
It shall behave like this: if i delete a category, all customers under the category shall be deleted, and all orders under each deleted customer shall be deleted also.
In xml mapping file, i aready set the autodelete to true.
now, back to my problem, i must populate the customercollection in customer category in order to delete customers away, and i must populate OrderCollection in each deleted customer before i can delete all orders! Another way is that to use DeleteCriteria. But, still, a lot of database queries must be done before i can remove all related data entries from database.
This shall not be the best way in handling with relational database, right?
Maybe there is another better way in the framework, please advise me ....
Sorry for the delay in responding - it's been busy :-)
You're right about the delete not being done the best way, however at the moment I haven't implemented a better solution.
If I get some time soon, I'll try an implement a better delete, but in the meantime could you create an entry in the Requests (RFE) section so that I have a reminder (and so you'll see when things get updated).
- Richard.
Hello,
in my opinion, such cases should be handled by the database and not by the programming logic.
A correct implementation of foreign keys with a delete cascade resolves that in a very elegant way....
uh