I have an issue where serializing an ORM relationship is only showing the first two records. The rest just show [] blank.
Here is an example relationship:
property name="endorsements" singularname="endorsement" fieldtype="one-to-many" lazy="false" fkcolumn="xxx" cfc="endorsements" remotingfetch="true";
Getting the JSON:
policy = entityLoad("policy",1018379202)[1];
serializeJSON( policy );
And a cut down part of the JSON:
{"id":12321,"endorsements":[{"effectiveDate":"July, 01 2009 00:00:00","active":true},
{"effectiveDate":"July, 01 2009 00:00:00","active":true},
"","","","","","","","",""]}
The empty strings should be other records in the relationship.
I've verified via debug files that the Hibernate query is bringing back all records and a cfdump shows this as well.
Thoughts?
The bug occurs in coldfusion.runtime.JSONUtils.serializeJSON() at around line 409.
If you are serialising a persistent cfc, it adds the fully qualified name of the cfc to an ArrayList, which is passed around recursively.
Then there is an if() statement which tries to locate the cfc's fully qualified name and once it appears more than twice in the list, leaves the function early with "{}".
Not really sure what they were trying to accomplish with this if(). Possibly to handle circular references?
This bug was logged back in April: https://bugbase.adobe.com/index.cfm?event=bug&id=3175667
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With