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?
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.
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.
Copy link to clipboard
Copied
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.