OS: Linux 5.15.49
Java Version: 11.0.16
Tomcat Version: 9.0.65
Lucee Version: 5.3.12.1
Hibernate Version: 3.5.5.89
Hi all, I have come across a property scoping issue within Hibernate classes where properties that are of a complex type (eg. Struct) are not being local scoped.
Lets say we have the below Hibernate class:
<cfcomponent name="Foo" persistent="true" output="false" >
<cfset variables.properties = structNew( ) />
<cfset variables.properties.SomeID = "" />
<cffunction name="getSomeID" access="public" returntype="string" output="false">
<cfreturn variables.properties.SomeID />
</cffunction>
<cffunction name="setSomeID" hint="" access="public" returntype="void" output="false">
<cfargument name="id" type="string" required="true" />
<cfset variables.properties.SomeID = arguments.id />
</cffunction>
</cfcomponent>
}
And we have the below test case:
<cfset x = EntityNew("Foo") />
<cfset x.setSomeID('1') />
<cfset y = EntityNew("Foo") />
<cfset y.setSomeID('2') />
<cfdump var="#x.getSomeID()#" />
}
The expected result would be 1, however the actual result is 2.
If we didn’t store SomeID within a Struct, but just as variables.SomeID, then the issue won’t occur. Similarly, if the property declarations are within the class constructor, the issue won’t occur.
Does this appear to be a bug or am I missing something?
Long time lurker here, love the project and appreciate the assistance!
Thanks