2 Replies Latest reply on Mar 7, 2016 12:28 AM by pnahtanoj

    many-to-many relationship not saving linktable

    pnahtanoj

      Got a bit of a legacy app that previously had flushAtRequestEnd set to true.  We've flipped the flag, and now our many-to-many relationships aren't working properly.  The individual records save fine, BUT the link table records are not being created.  Here's how the entities are basically set up.

       

      component persistent="true" table="Encounters" {

      ...

          property

              name="CaseFollowUps"

              singularname="CaseFollowUp"

              fieldtype="many-to-many"

              cfc="FollowUp_NEW"

              linktable="EncounterFollowUp"

              fkcolumn="EncounterID"

              inversejoincolumn="FollowUpID";

      ....

          public void function addCaseFollowUp( fu ) {

              ArrayAppend( variables.CaseFollowUps, fu );

              arguments.fu.addEncounter( this );

          }

      ...

      }

       

      component persistent="true" table="FollowUp_NEW" {

          property

              name="Encounters"

              singularname="Encounter"

              fieldtype="many-to-many"

              cfc="Encounter"

              linktable="EncounterFollowUp"

              fkcolumn="FollowUpID"

              inversejoincolumn="EncountersID";

      }

       

       

      I'm calling the 'addCaseFollowUp' convenience method on a preexisting Encounter within a transaction.  No errors thrown.  I see this Hibernate code for inserting the FollowUp_NEW record:

       

      insert

        into

        FollowUp_NEW

        (Note, UserDateTime, UpdateDateTime, CreateDateTime, DispositionID, FollowUpRequestID, CommunicationTypeID, UserID)

        values

        (?, ?, ?, ?, ?, ?, ?, ?)

       

       

      But I don't see a Hibernate query for inserting the EncounterFollowUp record.


      Suggestions?