1. Torque
  2. TORQUE-182

Additional methods for handling associated objects


    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: None
    • Labels:


      Assuming complexObjectModel=true and objectIsCaching=true (the default settings for generation)
      Consider a table (book) having a foreign key on another table (author).
      Couurently, in the Author object, the method addBook() is implemented, by which a book can be associated with the author and which adds it to the collection obtained by getBooks(). These books are also saved when the author object is saved.

      However, there are no methods by which associations can be removed, an associated book can be deleted or all associated books can be deleted.
      It would be nice if one could do these operations on an object level and these operations would be written to the database on save().
      The first possibility to implement this would be to generate methods removeBook(), deleteBook() and deleteAllBooks().
      The other possibility would be to use a custom list object which intercepts the calls to the add(), remove() etc methods and translates these operations to database operations (with the problem that remove() can be interpreted as removing the association as well as deleting the associated object, my preference being the latter)


        Thomas Fox created issue -
        Thomas Fox made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Thomas Fox made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 4.0 [ 12323291 ]
        Resolution Fixed [ 1 ]
        Thomas Fox made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            Thomas Fox
            Thomas Fox
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: