tracker issue : CF-3040725

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

Bug 81453:When you have a self joining entity the saveUpdateCache() method runs forever (or at least until you run out of RAM)

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Abram Adams / Abram Adams (Abram Adams)

Created: 01/05/2010

Components: Flex/Flash, AIR Integration

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 / 268370

Priority/Frequency: Major / Unknown

Locale/System: English / Win All

Vote Count: 0

Problem:

When you have a self joining entity the saveUpdateCache() method runs forever (or at least until you run out of RAM).  Often the only way to stop it is to go into Windows task manager and kill the process (on Windows of course)  - even if you stop debugging or close the app.I have not tested this on any other OS.
Method:

Create a CFC entity with a ManyToOne relationship to itself:
<cfcomponent persistent="true" table="users" output="false" alias="Users">
    <!---- properties ---->    
<cfproperty name="ID" column="ID" type="numeric" ormtype="int" fieldtype="id"  />
<cfproperty name="user_name" column="user_name" type="string" ormtype="string" />            
<cfproperty name="password" column="password" type="string" ormtype="string" />            
<!---- relationships ---->    
<cfproperty name="modifiedByUser"  fieldtype="many-to-one" cfc="users" fkcolumn="modifiedByUserID" />
</cfcomponent>

Then create the AS3 entity class like:

package com.myproject.model.vo{       
[Bindable]    
[RemoteClass(alias="Users")]    
[Entity]       
public class Users    
{          
  [Id]        
  public var ID:int;        
  public var user_name:String;        
  public var password:String;       
 // Relationships    
  [ManyToOne(targetEntity="com.myproject.model.vo::Users",fetchType="EAGER")]    
  [JoinColumn(name="modifiedByUserID",referencedColumnName="ID")]                    
  public var modifiedByUser:Users;    
public function Users()    {    }      
}}

Then do a fetch using the coldfusion.air.SyncManager and perform a saveUpdateCache() on the results.
NOTE: You'll have to have a table Users with the same structure and at least one record. 
You could use the following SQL to create that:
DROP TABLE IF EXISTS `Users`;
CREATE TABLE  `Users` (  `ID` int(10) unsigned NOT NULL auto_increment,  `Name` varchar(45) NOT NULL,  
                       `modifiedByUserID` int(10) unsigned default NULL,  PRIMARY KEY  (`ID`)) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
INSERT INTO Users (`Name`) VALUES ('John');
Result:

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

Watson Bug ID:	3040725

External Customer Info:
External Company:  
External Customer Name: Abram Adams
External Customer Email: 2C58192A446E406799201549
External Test Config: 01/05/2010

Attachments:

Comments: