1. In a case, where we are considering m2m, and it’s required to add a new entity record in the m2m table, an obvious case comes, where we create and save the entity first and then we add that entity in the m2m table. For example, when we add a new book to an exiting author’s book list, we first create a “Book” object and save it, and then we add this book to the author book list thru a static method. However, in that case, we might have to consider database server side or application level (ex: COM+) transactions, where the whole operation will be rolled back for any unsuccessful process in the full operation path.
2. While attaching the m2m table to a o2m table, in this case we have to perform data operations in two separate tables. We can do this either in the stored procedure layer at one time, where all required data will be passed thru stored procedure parameters and the stored procedure will perform operations in the separate table. Or this can be done separately from the application layer, which is useful, when we contain a very common format for CRUD operations for each and every database table in the stored procedure layer (generally when we generate CRUD stored procedures).