Robert Santen
Robert Santen

Reputation: 107

Property not recognized in Coldfusion ORM Persistent entity

I have a persistent ORM entity:

<cfcomponent persistent="true" table="MENU_recipeTypes" entityname="recipeTypes" >
    <cfproperty name="id" fieldtype="id" column="recipeType_id" generator="native" setter="false">
    <cfproperty name="name" column="recipeType_name" type="string">
    <cfproperty name="recipeType_help" column="recipeType_help" type="string">
    <cfproperty name="hasPrice" column="hasPrice" type="binary">
    <cfproperty name="recipeTypeOrder" type="numeric">
    <cfproperty name="exclusiveType" type="binary">
    <cfproperty name="recipe" fieldtype="one-to-many" cfc="recipes" fkcolumn="recipeType_id" type="array">
    <cfproperty name="recipeTypeDisplay" fieldtype="one-to-many" cfc="recipeTypeDisplay" fkcolumn="recipeType_id" type="array">
</cfcomponent>

On my local machine running Windows 10 and SQL Express 2017 with CF2018 everything runs smoothly. However, on the server running Windows Server 2019 Datacenter with SQL Express 2019 and CF2021, the property 'hasPrice' can not be found for some reason.

I am at a complete loss why this is happening.

Testing it out:

<cfset thisRecipeType = entityLoadByPK("recipeTypes", 5)>
<cfdump var="#thisRecipeType#">

Result:

Dump result

Data in the database:

enter image description here

So the hasPrice column for entity 5 clearly has a value in it.

ADDENDUM: It appears that MSSQL2017 accepts the type 'bit' or 'binary' as a valid type for boolean values but MSSQL2019 does not accept either and only accepts boolean. This does not cause an error but rather returns 'undefined value'.

Upvotes: 2

Views: 109

Answers (1)

Dan Bracuk
Dan Bracuk

Reputation: 20804

The problem is that the hasPrice property has type="binary". In ColdFusion, true/false properties should have type="boolean"

Upvotes: 3

Related Questions