tracker issue : CF-3040771

select a category, or use search below
(searches all categories and all time range)

Bug 81588:Table columns which or foreign keys to another table can often be set to NULL to reflect someting

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/

Reporter/Name(from Bugbase): Eric Twilegar / Eric Twilegar (twillerror)

Created: 01/12/2010

Components: ORM Support

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Minor / Unknown

Locale/System: English / Platforms All

Vote Count: 0


Table columns which or foreign keys to another table can often be set to NULL to reflect someting. Generally this occurs in one to one relationships. When loading one of these objects up via the ORM it is tricky to clear the foreign key if it is already set. That is to say in SQL   update TableA set FKCol = NULL where TableAId =5    .... FKCol currently has a value.The Coldfusion Entity CFC will come back with the property having a value isNull(myEntity.getFKCol() ) will return false.The trick is how to get that to return true. The way I've done this is by implementing a function in the Entity CFC called clearFKCol  which does StructDelete(variables, "FKCol" ) which "clears" the property.I've also used onMissingMethod so that I can have a "clear" for all properties.It would be nice if accessors=true does that for me.Addtionally I need this<cfproperty name="tableCol" useDefault="true" >So instead of placing NULL when there is no property set in an insert statement. insert = false kind of does it, but I want the user to be able to specify it...if they don't it uses the default. Ultimately it would nice if you could do a useDefaultSomeCol.Thanks....btw I've been pleasantly suprised by your implementation of Hibernate...good work.


Currently there is no way to easily clear a property in order to place NULL in the database. For now I add functions to the persitent CFC called clearProperty(); This does a StructDelete( Also I might use onMissingMethod to make it better. It would be nice if the accessors="true" auto generated clear or null or deleteXXXXX....whatever you fill is best to clear it out.In a related note it would be nice to be able to tell the database to use the default value. That is to ignore the property altogether in the insert statment. Otherwise you have to put the default in the <cfrproperty tag itself.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3040771

External Customer Info:
External Company:  
External Customer Name: Eric Twilegar
External Customer Email: 3D9A02F5446CCE0A992015D5
External Test Config: 01/12/2010