many-to-many relationship not saving linktable

New Here ,
Feb 28, 2016 Feb 28, 2016

Copy link to clipboard

Copied

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?

Views

242

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Mar 06, 2016 Mar 06, 2016
pnahtanoj wrote: But I don't see a Hibernate query for inserting the EncounterFollowUp record.
Is there perhaps a query that updates EncounterFollowUp? If there is none either, then run the code as a trasaction. That woud rule out the fact the ORM session ended prematurely.

Likes

Translate

Translate
Adobe Community Professional ,
Mar 06, 2016 Mar 06, 2016

Copy link to clipboard

Copied

pnahtanoj wrote:

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


Is there perhaps a query that updates EncounterFollowUp? If there is none either, then run the code as a trasaction. That woud rule out the fact the ORM session ended prematurely.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 07, 2016 Mar 07, 2016

Copy link to clipboard

Copied

LATEST

I don't recall as it's been a bit, but it's since been fixed.  I believe transactions may have been part of it, but I can't remember.  Will mark answer as correct.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines