tracker issue : CF-3037864

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

Bug 75961:(Watson Migration Closure)Primary key generation on linked tables

| View in Tracker

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

Reporter/Name(from Bugbase): Devin Holloway / Devin Holloway (Devin Holloway)

Created: 03/13/2009

Components: ORM Support

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Normal / Unknown

Locale/System: English / Platforms All

Vote Count: 0

Problem:

Primary key generation on linked tables.

If you define a many-to-many relationship with a linked table, the linked table does get created but with no PK. Generally this relationship needs a composite PK on the linked table involving both foreign keys.

The workaround is to create a persistent CFC for the linked table that describes the PKs.
Method:

component
{

	/**
	 * @column account_id
	 * @datatype integer
	 * @fieldtype id
	 * @generator native
	 */
	property numeric accountId;
	
	
	/**
	 * @fieldtype many-to-many
	 * @cfc Account
	 * @linktable account_favorite
	 * @fkcolumn account_id
	 * @inversejoincolumn favorite_id
	 * @cascade all
	 */
	property array favorites;

	/**
	 * @fieldtype many-to-many
	 * @cfc Account
	 * @linktable account_favorite
	 * @fkcolumn favorite_id
	 * @inversejoincolumn account_id
	 * @cascade all
	 */	
	property array favoritedBy;

}
Result:

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

Watson Bug ID:	3037864

External Customer Info:
External Company:  
External Customer Name: Devin Holloway
External Customer Email: 5E060FD6422E831A992015D5
External Test Config: 03/13/2009

Attachments:

Comments: