• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Doubt on Join Mapping documentation

New Here ,
Oct 07, 2010 Oct 07, 2010

Copy link to clipboard

Copied

Dear all,

Let me present the following case: I'm working against an Oracle database where I have two tables ASSET (id NUMBER, name VARCHAR2, asset_type_id NUMBER) and ASSET_TYPE (id NUMBER, type_name VARCHAR2).

What I want to try is to build an Asset.cfc with the id (numeric), name (string), and typeName (string) properties. I tried to avoid having an AssetType class loaded into the type property that later I had to access with asset.getType().getTypeName(), but having the typeName string directly as asset.getTypeName().

Then I read the "Join mapping in a CFC" section of the CF9 documentation and thought to have found an elegant solution. The document presents the Employee-Address relationship and uses the addressId joincolumn, but never explains if the addressId column is member of the Employee or the Address table. I guessed the addressId was a column of the Employee table pointing to the PK of the Address table, and tried to apply that logic to my case; of course, it does not work. Then I reached the conclusion that the addressId must be a member of Address table that maps automatically always to the PK of the Employee table.

(1) Is my conclusion right? I.e. is the joincolumn a member of the target table and joins always automatically to the defined PK of the source table? If this is the case, I cannot solve my problem this way as I want to join the target id column with the source asset_type_id column.

(2) Is there a way to override this and make the joincolumn to join to an alternative source column other than the PK?

(3) Does anyone knows the why of this limitation?

(4) Could anyone explain an alternative way for getting the type string directly with asset.getType() without creating an explicit AssetType cfc? Is there some pattern or best practice for this case?

Sorry for the long post and thanks in advance for your help.

Regards,

Jesús

TOPICS
Advanced techniques

Views

274

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2010 Oct 07, 2010

Copy link to clipboard

Copied

LATEST

Ok,

A solution seems to be the @formula parameter (sorry I didn't find the http://forums.adobe.com/message/2298153#2298153 post before). Any solution using the join mapping? (I guess not). Any other ideas?

Just one question for the experts: if I use the formula for several properties calculated from the same table, does hibernate intelligently translate them to a single query?

Thanks,

Jesús

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation