Get the App
SLTechnology News&Howtos  ›  Database  › 

How to realize the record of database modifying many-to-many intermediate tables

Shulou Source: shulou.com Published: 2022-05-31 17:40:44 10月02日 Update

This article mainly explains "how to realize the record of database modifying many-to-many intermediate tables". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to achieve the database to modify many-to-many intermediate table records"!

Delete the corresponding fields of the intermediate table before adding them

* when the unilateral table is found from the database, the set container of this object must be cleared with clear ().

* set the cascading style in the one-to-many cascading configuration file to cascade= "all,delete-orphan" at the same time

* delete all the data corresponding to the objects to be modified in the intermediate table

* re-persist the objects of intermediate tables through save () or merge ()

This method can be used when only the data of the intermediate table is modified, but not the data of the unilateral table.

Second, modify the unilateral table by cascading and modify the intermediate table at the same time

* when the unilateral table is found from the database, the set container of this object must be cleared with clear ().

* set the cascading style in one-to-many cascading configuration files to cascade= "all,delete-orphan"

* add the po object corresponding to the intermediate table to the set container of the unilateral table

* modify the unilateral table with merger ().

-this method can be used when unilateral and intermediate tables are modified at the same time.

At this point, I believe you have a deeper understanding of "how to modify the record of many-to-many intermediate tables in the database". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Data unilateral object database simultaneous container method content file style learning configuration practical deeper interest field practical practical easy to operate more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information NVidia OPPO Reno Microsoft