http://coldfusion.com logo
#cfml-general
Title
# cfml-general
g

Gregory Alexander

03/04/2022, 2:42 AM
ColdFusion 2021 changed the way to output ORM arrays of structures. Using ColdFusion 2016 or prior, we used to be able to output an HQL query with a Java hashmap using #queryName[row].ColumnName# or using #queryName[row]["ColumnName"]. However, it seems that ColdFusion 2021 deprecated using the dot notation (queryName[1].ColumnName). I learned this from John's "Building applications with ColdFusion ORM", page 93, and have several years of code that is reliant upon it. When I am using the dot notion I am getting an 'Element COLUMNNAME is undefined in a Java object of type class java.util.HashMap., but using [queryName][1]["ColumnName"] everything works fine. I have thousands of lines of working code that use the dot notation and they all appear to be broken. Has anyone found a way around this?
s

seancorfield

03/04/2022, 4:01 AM
I would have thought a carefully-crafted regex find'n'replace would be able to do most of that for you -- but maybe you also have a lot of arrays of structs and don't have enough uniqueness in the names to distinguish the two...?
g

Gregory Alexander

03/04/2022, 4:12 AM
I may have to resort to that Sean. I am a bit perplexed why it was changed.
s

seancorfield

03/04/2022, 4:25 AM
I suspect it was one of those undocumented implementation details that they never expected anyone to be using, and they fixed an unrelated bug in that machinery that just happened to stop it working.
There are a lot of undocumented things in CFML that have broken over the years.
😬 1
Especially in the boundary between actual CFML code and the undocumented Java classes that implement it...
👍 1
a

Adam Cameron

03/04/2022, 8:54 AM
My first question here would be "was this change by design, @Mark Takata (Adobe), or is it a bug?" Second I would then go "either way, can you pls improve the docs @saghosh "
👍 1
g

Gregory Alexander

03/04/2022, 10:06 AM
What I am frustrated about is that both Javascript and Java use the dot notation to output an array of structures- ie: for (var i = 0; i < capabilityDsData.length; i++) { var capabilityId = capabilityDsData[i].CapabilityId; capabilityIdList.push(capabilityId); }//..for (var i = 0; i < capabilityDsData.length; i++) ColdFusion is now making the same logic completely different than what I used to be able to use for all three languages and keep them consistent. Not only that, now I have thousands of changes to make which are completely unnecessary. Sigh...
a

Adam Cameron

03/04/2022, 10:50 AM
array of structures
But as you say:
Java hashmap
A hashmap is not a struct. I suspect it used to be a struct, and that is the problem. And this... in turn... sounds like a bug to me. Adobe ought not have changed it from a struct to a HashMap. I would bet £5 that they changed some internal implementation detail, and accidentally removed the translation from the HashMap that Hibernate returns to be a CFML struct that should be what is exposed to the CFML code. A HashMap is not a type directly supported by native CFML code, so native CFML functionality should not ever be exposing them.
👍 1
2 Views