tracker issue : CF-3298269

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

Entity extends with join column appears to link wrong way

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Andrew Scott / Andrew Scott (Andrew Scott)

Created: 07/29/2012

Components: ORM Support

Versions: 9.0.1

Failure Type:

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Windows 7

Vote Count: 0

Problem Description:

This is going to be perhaps a little hard to explain but lets try, I have 2 tables that extends another table, that seems to be broken, in other words the key and relationship seems to be backwards.

In Grails I can do the following.. Grails automatically joins on the ID field, so it is not something that needs to be added.

class Content {
     String author
}

class BlogEntry extends Content {
    URL url
}

class Book extends Content {
    String ISBN
}

And I can load up Book and get the property of parent and child as one entity, in ColdFusion it appears to do the same thing, but when there is data in the table it refuses to work.



Steps to Reproduce:

Create the following entities..

component persistent="true" table="account" {
	property name="username" ormtype="string" unique="true" fieldtype="id" length="50";
	property name="password" ormtype="string" length="50" notnull="true";
	property name="email" ormtype="string" unique="true" length="150" notnull="true";
}

component persistent=true extends="account" joinColumn="username" table="forum" {
	property name="forumhandle" ormtype="string" length="50";
}

component persistent=true extends="account" joinColumn="username"  table="blog" {
	property name="profilename" ormtype="string" length="50";
}

Populate the table with dummy data for account, then add data with the username for the other tables. This needs to be done manually, so that it mimics already existing data. But you need to make sure that the application is run, so that the tables are created.

Once the tables are created, we can then then do the following code to show the problem.

<cfset obj = entityLoad("account") />
<cfdump var="#obj#" />

This will show that the forum table is linked when it is dumped, this should not be the case. Dumping the account should only be that table.

This is further compounded by the following problem.

<cfset obj = entityLoad("blog", 'andrews') />
<cfdump var="#obj#" />

When the page is run, this will dump and empty record, even though the data is indeed linked by the username field as the supposed join.

<cfset obj = entityLoad("forum", 'andrews') />
<cfdump var="#obj#" />

Will dump the full entity, as with the first example for account. This seems to be working backwards to how grails does it and is confusing to say the least.

This is from my understanding a bug, because the relationship join seems to be backwards.

Actual Result:

Expected Result:

Any Workarounds:

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

Watson Bug ID:	3298269

External Customer Info:
External Company:  
External Customer Name: ascott67
External Customer Email:  
External Test Config: My Hardware and Environment details:



This was tested on MS SQL Server 2008 R2, so I am not sure if this works on mySql or not, but will try it as soon as I can, but I will assume that it behaves the same way.

Attachments:

Comments:

This is Table per subclass without Discriminator as described in http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS027D3772-2E98-4d5b-8800-054A62EBF8D9.html It is working as it should.
Comment by Himavanth R.
18648 | May 09, 2014 03:53:50 AM GMT